Two related issues (#19444 and #19362) were fixed in #19449, but I discovered that swapping type variables still gives incorrect results if the generic type contains some additional optional type variables.
class Foo[X, Y, Z=object]:
def test(self, swapped: Foo[Y, X]) -> None:
reveal_type(swapped) # "Foo[X`1, Y`2, builtins.object]" ❓️❗️