Detaching a copy moved the shape-ref of every shape under its first-level
nested copies up one level. Below a nested copy swapped in the detached
copy itself, the swap already points it into the swapped-in main, so its
children ended up one level too far and the detach failed to save with
:missing-slot.
Skip those swapped nested heads, and their descendants, when advancing
the nesting level.
Closes#13176
AI-assisted-by: claude-opus-5-5