Extending module with many submodules

Let’s say we have got a module. We want other developers to extend our module with new functionalities.

How do you deal with this case?

The problem might be in the shared configuration and how to manage many submodules at once. This is the moment where nested modules come to mind. But what if I would like to modify parent module’s method in a way that every submodule can use it modified?

I’m looking for a solution like hooks or observers.

What is the Yii 2 way here?