config/optional directories are search for any configuration entities which have an entity type provided by the new module. This is the most basic dependency a module can have.
We can do better than this. We can determine if any optional configuration that does not exist has a dependency on the extension that is being installed and then create it if this condition is met. This means that modules can provide optional configuration the has multiple dependencies and it will be installed when all the dependencies are met.
For example, a module could provide a view which has a dependency on itself, Views and Block modules. The module itself does not have a dependency on Views or Block. It's installed before either of those modules. With HEAD if Block then Views is enabled the view will be created. If this occurred the other way around it would not be.