As far as I know, there's no way in scripting to only do that when necessary, and even a plugin would be difficult to code without essentially writing a full music library management program. If you don't mind having that info on every album, though, the script's actually not all that difficult. I'd even expect it to work perfectly well in iTunes, since the files wind up with two different album names.
$noop(Precombine fields to make it easier to check for their presence)
$noop(Clean up after ourselves)
Of note, the script uses the default semicolon to separate the catalog numbers, and I don't see any way of changing that before flattening the multiple values. If you'd really rather use a comma, replace the second line with the following one, but it will also change any semicolons (if followed by spaces) that should be in the catalog number.
$set(_albumdisambiguation,$replace(%catalognumber%,; ,\, )$if(
Also, I find a colon looks better before the medium type if you do use the commas; if you agree, I'd recommend changing the "
\," in the sixth line with "
I did notice a bug in the UI when using the script: the album title in the right panel acts like the media hasn't been added. It properly shows up in the fields in the bottom panel, though, so everything else should still work fine.
And for anyone who does just need the EP/Single marking:
$noop(Only add "EP" if the album doesn't already end with it)
$noop(This will still run into issues with, eg. "...\(EP\)")
$noop(Don't add anything for "album" release type)