Issue #2997982 by longwave, plach, johns996: Orphan term hierarchy records can cause taxonomy_update_8502 to enter an infinite loop