Try to fix aliases and deferred service providers.

As seen in #3252, automatic resolution did not work for aliases that referenced deferred services. This should fix it.

There are more problems with deferred services, I think (remember our discussion about the `extend()` method?), I'll take another look at these.