Remove dependency on container, removing service locator antipattern

Backport to stable6 from https://github.com/owncloud/core/pull/8017 

@DeepDiver1975 @tanghus @MorrisJobke