[5.0] Reintroduce ServiceProvider::when(), which allow registering/loading service provider only when events is fired.

Signed-off-by: crynobone <crynobone@gmail.com>
Merge pull request #6179 from crynobone/feature/when-service

[5.0] Reintroduce ServiceProvider::when(), which allow registering/loading service provider only when events is fired.