PERF: get_dtype_kinds
Upshot: avoid doing lots of non-performant is_foo_dtype checks.

This fixes a little more than half of the performance hit in the benchmark discussed in #34683.
sure, do we have sufficient bencharmarks for this?