This was a known regression that came with astral-sh/ruff#21784.
The cause is calls to normalized that happen inside of FunctionType::has_relation_to_impl, as described here. Those calls are themselves a performance optimization, and deleting them fixes this regression, as described here. We'll want to come back to this after TypedDict "tagged union narrowing" is in (#1479 (comment)), to see how much of the regression remains.