Refs #21182 - Refactoring to speedup "broken relations algorithm"