[ty] Do not promote literals in contravariant positions of generic specializations (#21171)
## Summary
closes https://github.com/astral-sh/ty/issues/1284
supersedes https://github.com/astral-sh/ruff/pull/20950 by @ibraheemdev
## Test Plan
New regression test