[ty] Fix bidirectional inference with PEP 695 union type aliases (#22988)
## Summary
Fixes https://github.com/astral-sh/ty/issues/2682
Fix bidirectional type inference when PEP 695 type aliases expand to
union types. Previously, when a type alias like `type MaybeList[T] =
list[T] | T` was used as a type annotation, the specialization inference
would fail to correctly infer type parameters from the assigned value.
The issue was that type aliases were not being expanded to their value
types before filtering union members for specialization inference. This
prevented the type checker from identifying class instances within the
expanded union that could be used to infer generic type parameters.
The fix expands type aliases to their underlying value types before
performing the union filtering and reverse type inference. This allows
bidirectional inference to work correctly with union type aliases while
maintaining proper variance handling.
## Test Plan
Added test cases in
`crates/ty_python_semantic/resources/mdtest/generics/pep695/aliases.md`.
Co-authored-by: Claude <noreply@anthropic.com>