[ty] Reduce repeated work during specialization
Cache protocol declarations and inheritance paths before applying type
arguments. Specialize only classes that contribute protocol members, while
keeping transformations inside the caller's recursion guards.
Retain receiver constraints through substitution and solve them during
compatibility checking. Share MRO storage and reuse callable parameters
when a mapping leaves them unchanged. Reuse completed disjointness checks
within the same analysis operation.