Sadly, as far as I can tell, there is no public API to interrogate the
set of known classes, either by loop, lookup, or count. Had another
look over the weekend but couldn't find anything. I don't think Class
even exists as a scriptable object, at least nothing in the scripting
API ever references Class objects.
It sort of makes sense that the code for it would be missing, since the
relationship between class-feature, feat, skill, etc. and Class is lost
after a level has been applied. I think removing levels is fiddly for
exactly this reasons (there is no in-code way to know what went with
what).
Phil