Taking a step back, what's the reason for detaching the client surface when the window is hidden? The compositor will handle this for us, not showing any subsurfaces if the parent surface is not mapped.
(This compositor behavior is good enough for now, while we are not yet dealing with GL/VK in (possibly nested) child surfaces)