window-x11: Fix stage window check when running under non-X11 backends

This code also runs when under the native backend for XWayland, so we
can't crash on an invalid cast there.