getting the extension config in a compiler pass is the wrong way to implement it. At this time, the config has already been processed to configure the container, so you should deal with the container content instead.

Thus, your logic is currently broken, because you don't take care of merging the different extension configs together (which would require duplicating part of the work done in the extension)