That is indeed a very interesting edge case...
For regular popups you can define the parent of the popup like this:
so you'd still need to implement some kind of custom system that will associate certain popups with a module, but that shouldn't be too hard.
As for the tooltips, I'm not sure how you'd be able to intercept their creation. To be honest, I never had thought of a scenario where a tooltip would be needed to be injected.
Maybe anybody else on the list is a Flex guru that can shed some light on this particular problem?