Currently, extensions use global variables to register handler classes (or object specs or instantiators) to define ContentHandlers, SpecialPages, APIModules, etc.
Make ExtensionRegistry a service. Give it a getHanderSpecs( $type ) name. In ServiceWiring, use a call like e.g. $extensionRegistry->getHandlerSpecs( 'SpecialPages' ) when constructing SpecialPageFactory. Internally, ExtensionRegistry can map the $type parameter to global variables, e.g. 'SpecialPages' to $wgSpecialPages. In future versions, extension.json can support a 'handlers' key that would bypass the global variables.
This removes the need for global variables, and avoids the need for factory services to offer methods for registering handler specs at runtime.
SlotRoleRegistry already allows extensions to register handlers by calling defineRole, but this is cumbersome since it requires the extension to use the MediaWikiServices hook to then register a service manipulator callback.