hook_civicrm_buildProfile not working on Drupal 8
The buildProfile hook as documented here: https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildProfile/ doesn't work in Drupal 8, at least not on the user's corresponding profile tab.
Specifically, the ability to add css/js to a profile form fails, e.g. like the example in the documentation:
CRM_Core_Resources::singleton()->addScriptFile('org.example.myext', 'some/fancy.js', 100);
The hook fires with the correct profile name, but adding any resources does not result in those resources showing up on the Drupal users's profile page.
I believe the error is in src/Form/UserProfile.php where the form html is generated and returned without checking for any associated resources.
One way of fixing it is to only support the 'form-bottom' region, and add the resources in the buildForm function, e.g.
$html .= \CRM_Core_Region::instance('form-bottom')->render('', FALSE);
after line 86 of that file.
There are lots of other civicrm resources that are not included, and maybe that's a good thing on purpose.