Wait a second, how does Qt do that? If the application developer chooses to use client side decorations in an application, e.g. something similar to GtkHeaderBar, how does Qt know how the application should look like with client side decorations disabled, without the application developer explicitly adding support for that?
I'm not sure if this completely answers your question but ...
Ordinarily QT will automatically render decorations inside an application's Wayland window, but if the QT_WAYLAND_DISABLE_WINDOWDECORATION environment variable is set, it only renders the content inside the decorations. The window manager can them draw it's own decorations around the outside, when it composites the desktop.
It's not ideal. There's no mechanism for an application to supply hints to the window manager to control it's decorations like in X. Nor can the application draw custom borders like when using client-side decorations. There's really no other way of implementing the stacking and tabbed window layouts which are popular in tiling window managers though. Thankfully it's good enough for most applications and the compositor can have overrides (e.g in a user config file) for special cases.