I am afraid such way of trying selectively fix up Z order will break more than fix. The correct Z order is not handled in general and enforcing that for specific particular case is likely not correct. This way 'transient for' should be set throughout for each and every our window to ensure the ordering, but then it has side effects and unlikely to work very well.