[ty] Allow `if type(x) is Y` narrowing for types other than class-literal types (#22729)
## Summary
Fixes https://github.com/astral-sh/ty/issues/2565.
This PR adds support for `if type(x) is Y` narrowing where `Y` is a
subclass-of type, type-alias type, or typevar type.
## Test Plan
mdtests