you are missing the forest for the trees.
zoning does not prohibit you from owning a pig as a pet. have you ever seen the kind of nutrient rich runoff a pig farm produces?
Ok, I agree with this, but in this case there is a direct impact to the adjacent landowner receiving this runoff. So regulate that.
For some reason we craft all these laws to avoid the possibility of bad things happening, creating these broad dragnets that impact so many things unintentionally, rather than just regulating the thing we don’t want directly.
Runoff isn't the only concern. There's noise, big-rig traffic, odor, unappealing landscape (important to some). At some point it's a lot cheaper and easier to just regulate with zoning than to regulate each individual component of a site[0]. And frankly both sides -- residential and farmer -- should be happy to be away from each other.
0: Which, of course, developers would also object to and would lead to a lot of patchwork regulation due to grandfathering.
What you're describing is a recipe for a convoluted and incomprehensible zoning code that tries to predict every possible consequence instead of simply stating what people don't want.
For some reason we craft all these laws to avoid the possibility of bad things happening, creating these broad dragnets that impact so many things unintentionally, rather than just regulating the thing we don’t want directly.