Are you saying a boat connected to mains on its own cannot suffer from galvanic corrosion?
Think again!
No need for another boat to be nearby.
https://www.victronenergy.com/media/pg/The_Wiring_Unlimited_book/en/galvanic-corrosion.html
Galvanic corrosion is caused by an electric current that enters a boat via the shore power earth wire and returns back to shore via the water. These currents can cause corrosion to the boat’s underwater metals, like the hull, propeller, shaft and so on. This current is called galvanic current.
Galvanic current is a DC current. It is caused by the natural voltage difference between metals. A galvanic current can only exist when there is a closed electric circuit. A conductor belonging to another electric circuit can be part of the galvanic corrosion circuit. If a boat with a metal hull is near the shore a natural voltage difference of 0.1 - 1 Vdc exists between the hull and the water.
This potential difference leads to nothing as long there is no completion of the electric circuit. But, as soon as shore power is connected to the boat, the shore earth is automatically connected to the boat's hull and the electric circuit is complete. Now the following circuit is made: hull - water - shore - earth spike - earth wire - hull. A galvanic current will flow through this circuit. The galvanic current partly runs through the AC circuit but is not related to that circuit. Current will continue to flow until the potential difference is eliminated. The height of the current depends on the resistance of the electric circuit. The resistance is determined by factors like the length of the shore power cable and local earth spreading resistance.