Until type forms are properly supported by the type system, I wonder if this could be special cased?
from typing import Any
isinstance(1, str | Any) # no error, fails at runtime with TypeError: typing.Any cannot be used with issubclass()
FYI mypy is incorrectly inferring this as a types.UnionType but it is actually a typing.Union(#12369), I don't think you can have a UnionType with type forms in it.
PyCharm correctly warns here:

related: python/typeshed/issues/7505