Add infrastructure to extend generic classes using metaclass hook