Try using SentinelJS (or stealing code from it, it's on MIT) instead of nasty code in TextInputWidget#installParentChangeDetector. https://github.com/muicss/sentineljs
The idea here is to create custom CSS animations for each element we're waiting for and listen for 'animationstart' event on them, which will only be fired after it's attached to the DOM.
No idea about performance and reliability compared to what we have now. Needs trying and testing.