Speedup __isinstancecheck__ on pydantic models when the type is not a model, may also avoid memory "leaks".