Track depths on deduped children

Fixes a very specific error case where deduped children won’t receive the depths object due to it being omitted by the caller when optimizing.