PERF: use isinstance(obj, Foo) instead of ABCFoo
per discussion in #27353, isinstance checks with the ABCFoo are about 4x as expensive as the Foo checks.  Individually they are still very small, but they add up.
Thanks!