[ty] Reuse parameter unions when filtering overloads (#29823)
## Summary
A cold CLI check of NumPy went from 13.64 s on `main` to 7.02 s with
this change (48.5% less wall time). These are means from 12 paired Linux
runs using optimized `profiling` builds. Both builds emitted the same
2,147 diagnostics.
On `main`, 57% of CPU samples fell inside overload filtering for calls
with `Any` or `Unknown` arguments. Most of that time went into
rebuilding unions of parameter types from earlier overloads.
To test three successive prefixes, we used to add `A`, then add `A` and
`B`, then add `A`, `B`, and `C` again. We now keep a union builder for
each argument position and add each new overload’s parameter type once.
We still test the prefixes in declaration order and stop once a prefix
covers the arguments.