[ty] Reachability analysis for generic function calls (#23419)
## Summary
If a generic function's return type depends on a type variable, and the
argument passed resolves that type variable to `Never`, the call should
still be treated as terminal:
```py
def identity[T](x: T) -> T:
return x
def f() -> Never:
identity(exit()) # should be detected as terminal
```
This is a tiny win for correctness, but unfortunately a small drop in
performance and slight increase in memory usage, because we need to
infer more call expressions upfront. If we think it's not important
enough, I'm also okay to change this to a test-only PR that documents
this as a known limitation. If we merge it, I might follow up with an
idea to simplify the code in a [slightly larger refactoring
PR](https://github.com/astral-sh/ruff/pull/23378).
## Memory usage
Insignificant changes on some large internal projects, a 2% *decrease*
in memory usage when running on home-assistant/core.
## Ecosystem
No ecosystem changes, as far as I can tell.
## Test Plan
New Markdown tests