[ty] more precise exception types when catching a union (#25076)
## Summary
Fixes https://github.com/astral-sh/ty/issues/3432.
Currently if you `except some_var as e:` where `some_var` is a union
type, we aren't able to extract a precise type for `e` from it; this PR
adds that ability.
## Test Plan
Added mdtest.