[runtime] Replace hand-written type look up/caching with GENERATE_GET_CLASS_WITH_CACH...