Ensure imported targets in sibling dirs are deduplicated

Fixes: #26284
7 files changed