Deduplicate code in modmanager_static and modmanager_dynamic
Automatically register ServiceProviders created by modules