Fix join of Any against a union type (#12068)
Make the join of a union type and Any commutative.
Previously the result depended on the order of the operands,
which was clearly incorrect.
Fix #12051, but other use cases are affected as well.
This change was split off from #12054.