[ty] Avoid repeated work in nested match patterns (#28926)
## Summary
Nested class patterns over recursive unions can become slow as the union
and nesting depth grow:
```python
from __future__ import annotations
from typing import TypeAlias
class Wrap:
inner: Node
class Leaf: ...
Node: TypeAlias = Wrap | Leaf
def visit(node: Node) -> None:
match node:
case Wrap(inner=Wrap(inner=Wrap(inner=captured))):
pass
```
Previously, overlapping union members could cause us to analyze the same
child pattern and type repeatedly, both when a pattern succeeds and when
checking which values can fall through to later cases. We now reuse
structural pattern results within each analysis and deduplicate binding
contributions, while keeping subject aliases separate from extracted
values.
Closes https://github.com/astral-sh/ty/issues/4596.