Problem/Motivation
Imagine the following use-case:
You are installing media_entity_instagram and you have a second module, for example thunder_media, which contains media_entity.bundle.instagram.yml as optional config. media_entity.bundle.instagram.yml has a module dependency on media_entity_instagram.
So after the installation, media_entity.bundle.instagram.yml was imported successfully from ConfigInstaller::installOptionalConfig() during ModuleInstaller:install(). So far so good.
Now our thunder_media also contains several field and view/form-mode configs as optional config. These configs don't have a dependency on the module media_entity_instagram but on the config media_entity.bundle.instagram. installOptionalConfig() doesn't pick up the new resolvable dependencies recursively.
Proposed resolution
Let ConfigInstaller::installOptionalConfig() pick up direct and indirect optional configs.