Fix GetGeneration GC API test failure under interpreter (#131918)