Drupal defines the CoreServiceProvider class which is used to add the twig, twig.loader.filesystem, and module_handler services.
Since the Drupal 8 way to register a service from a module is using the .services.yaml file, is there any case where a class similar to CoreServiceProvider
should be used?