[wip] Fix for #19774 not using metaclasses.