Drupal service 'site.path' is deprecated in drupal 9 and will be removed in drupal 10
In https://github.com/civicrm/civicrm-core/blob/master/setup/src/Setup/DrupalUtil.php#L23 it calls
But I'm wondering why that function getDrupalSiteDir() even exists and why it's not part of CRM_Utils_System_X. Maybe a timing issue since civi isn't installed yet at that point?
Anyway the relevant drupal issue is https://www.drupal.org/project/drupal/issues/3074585#comment-13220446.
Because of the (bleep)
@trigger_error usage that drupal uses though it only comes up when running unit tests in drupal's own testing environment (until drupal 10 when it will hard fail, effectively nulling the effect of outputting a deprecation for most people).