Yes! there is a method in the Reflection class isUserDefined https://www.php.net/manual/en/reflectionclass.isuserdefined.php
the other methods use the reflection class and then a subtractive check. With this you get just what you need in a single line of code.
$reflect = new \ReflectionClass::isUserDefined();
or
$rc = new \ReflectionClass($class);
exit(var_dump($rc->isUserDefined));