In parmed.openmm.parameters.OpenMMParameterSet._write_omm_patches(), there is logic that tries to apply patches to all applicable residues and write the "best" or "consensus" definition. This causes invalid patches to be written for parts of the CHARMM force field (see openmm/openmm#4800 for example), in cases where there really needs to be multiple versions of a patch present.
I have a fix for this that I am using for our conversion of the latest versions of CHARMM force fields to OpenMM FFXML. It generates multiple versions of each patch as necessary with different names. There are a few limitations like restriction to <ApplyToResidue> (rather than <AllowPatch>), and I have a few questions about the expected behavior of ParmEd in a few cases, but I can submit a PR to discuss if desired.