BUG: Fixes SystemError in dtype(user_defined_type).name

Adds an additional check that the "numpy." prefix exists before removing.

Closes #4357.