Scratches does have a lot of causes, bacterial, fungal, photosensitivity, allergies, parasites, and probably more. The connecting factor is the immune system, which copper and zinc play a very important role in. SOD - superoxide dismutase - is a critical component of the immune system, and 4 minerals in particular make up 4 SODs - iron, manganese, copper, and zinc. Fe and Mn are in no shortage in the vast majority of diets, through forage alone. It’s cu and zn which are often low. That’s why boosting those 2 makes such a big difference for a lot of horses.
But, the immune system isn’t that simple, so adding cu/zn doesn’t mean it’s a guaranteed fix. But it DOES work in a whole lot of cases, and like Mouse said, sometimes it’s about adding a good deal more than you think should work. And IME, the darker the horse’s coat, the more cu/zn it takes. Cu/zn also play important roles in skin health, which is needed to help the skin be the protective barrier it’s supposed to be. Other nutrients do that too, like Vit E and selenium.
Rain rot is different, also immune related, caused by the gram-positive bacteria Dermatophilus congolensis, but it actually has some fungal properties IIRC.
The bacteria that cause these things live in the world, in the soil, on animals in general. But since the causes of scratches are a lot more varied, it depends on the actual cause for a given situation as to which treatment works best. That’s why some have to add a dewormer, some have to add an anti-fungal, etc