The better solution than injecting the container everywhere would be to define the extension class itself as a service, so that it can get whatever it needs injected directly as well.