A theme's services.yml is not loaded, so the #[LegacyHook] functions that Drupal 10 calls create the stateless class themselves.
Closes #3634703