For anyone running into the same issue, I haven’t found a way to do this. To work around that, I am using a patched version of KiCad 7, which has the line
%ignore NET_SETTINGS::m_NetClassLabelAssignments;
in pcbnew/python/swig/board_design_settings.i removed. Using that, I can assign net classes to nets by modifying that map from Python directly (the keys are the net names, the values the net classes)