The case in the if is true for UNIQUE indexes. As this is only called for checkNoReferenced, a unique index should never come through as the index for the referencing side is always automatically created and non-unique.

Or am I misunderstanding the flow?

Assuming I'm not, the code would need to traverse to logical children and check for siblings instead of 2 deeps and a logical. Since that isn't actually needed though, removing the if and asserting !unique is probably better.