[ty] Lazily initialize `UnionBuilder` when transforming a union type (#24929)
## Summary
This early return improves performance.
I tried the same thing at intersections, but there wasn't much change.
It seems `UnionType::map_leave_aliases` was a particularly hotspot.
## Test Plan
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>