As a layman for modding.
Maybe go to the flamethrower entity and see if there’s a tag that can still damage friendly in the “no friendly damage” setting and apply it to other gun, or modify the flamethrower to make it a normal gun, and then set the global setting to Set as no friendly damage.
But even if this is possible for small arms , fixed weapons and artillery will lose friendly damage, which is not what you want.
I would replace the word weapon with ammunition, we have multiple types of weapons using one ammunition, with each update with a new weapon you will have to adjust the mod, with ammunition this frequency will greatly decrease.