You said you wanted to solve this in software on the Mac - I came across this company recently, a $19 app that sounds like it might meet your needs: https://staticz.com/soundcontrol/
I had another thought about this issue, though - a hardware solution. What if you put 2 inexpensive equalizers into the signal path, one for each side? You could alter the settings to suit your affected side, then perhaps adjust the other side as necessary to compensate. You can get pretty cheap ones from Schiit: their Loki is $149. Not sure what you’re using for a source (your Mac?) or for an amp, but you might need a dongle that does 3.5mm -> dual RCA, then run the L side to one equalizer and the R to the other. Same idea for the outputs from the equalizers: use only one cable on each, then L & R are reunited at the back of your headphone amp. You might be able to get away with just one equalizer to alter the R signal path, but I wonder if that equipment asymmetry might introduce some subtle phase issues in the music.
The same idea should also work to independently adjust the gain for L/R, if the issue included volume sensitivity as well as frequencies. I don’t know if independently adjusting the L and R volumes is exactly the same thing as adjusting the balance - maybe it is. I swear I have no affiliation with Schiit but their “SYS” device is $49. Two of those, using only the L connectors for one and only the R for the other, would allow independent volume adjustment. Ideally, you’d then run these two outputs back into a headphone amp, so you’d have a single volume knob to adjust loudness w/o messing up your balance settings.
This is starting to add up, even with Schiit’s pretty low per-device prices! But this would give really good control, without doing a deep dive into your Mac’s audio settings. And it would always work, no matter what device you use for a music source.