Is there any case where a module needs to implement a class using ServiceProviderInterface? 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 &lt;module name&gt;.services.yaml file, is there any case where a class similar to CoreServiceProvider should be used?
In short, nope. The Twig service registration is written by Fabien Potencier himself and I doubt anyone will have anything as complex as Twig to necessitate this level of complexity in registration. The module handler is just fanciness, we could've written an override for the module handler during install time. Unless you are writing an install profile which uses a service, you won't face this problem.