Public water companies add corrosion inhibitors. When many of them switched to using monochloramine instead of chlorine, they had to switch to use different corrosion inhibitors. Initially there were reports of corrosion after the switch in some communities until they sorted this all out.

The sacrificial anode in water heaters is separate and is there primarily to protect the water tank (which is usually glass lined, but there are voids where this is exposure to steel), not so much for the copper.

Richard