On Wayland is even "worse", because each window surface is completely separate from every other window surface by design; each window has its own coordinate system, that has an origin in the top-left corner of the window. A window *cannot* be obscured by another window, as far as the toolkit is concerned.
If you're targeting an X11 system from the late '90s/early '00s, then visibility notifications *may* be emitted (though they are never guaranteed). On anything more modern than that, or on Wayland/Windows/macOS, visibility notification events are either non-sensical, not emitted, or not possible by design.