Are these the classes the user is allowed to instantiate (under a specific node)? Then you can use the content/can_instantiate_class_list fetch function: http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/can_instantiate_class_list
If that's not the case, you can request an enhancement (http://ez.no/community/bugs ) for the class/list fetch function, or try to hack it yourself. You can find the code of the fetch function in kernel/class/function_definition.php and kernel/class/ezclassfunctioncollection.php. Good luck!
is hack the best solution to implement specific functionality?
No it isn't :-) Normally you would create an extension with a new module and fetch functions. But I wouldn't call this "specific functionality", it concerns the default class module and the needed function can be useful for others too, so I think it should be part of the kernel.