Further speed up union simplification (#12541)
This tweaks a change made in #12539 that may have slowed things
down. The behavior introduced in the PR was more correct, but it's not
worth a potential major performance regression, since union
simplification is not something we have to get always right for
correctness.
Work on #12526.