Copying a copy nested inside another copy moved the shape-ref of every
shape under it up by the same number of levels. Below a nested copy that
was swapped in one of the dropped levels that count is too high: the swap
already points it into the swapped-in main, so its children ended up one
level too far and the paste failed to save with :missing-slot.
Count the levels per nested head instead, stopping at the level where it
was swapped (new ctf/get-swap-level), for the copied head too. The ref
chain used to collect touched flags now also follows deleted components,
like advance-shape-ref already did, so inherited slots are kept.
Closes#13076
AI-assisted-by: claude-opus-5-5