Open seacock(s) are causing the problem
When head seacocks are left open while underway, an effect known as "ram water"--pressure of the hull against the water--can force water up the head intake hose into the bowl, or up an open overboard tank discharge through hull to fill the tank, overflow it and send water back toward the toilet. The cure: keep seacocks closed except when actually in use.That SHOULD be easy to do...and when it comes to the tank discharge thru-hull, there's no excuse not to. But the head intake is often a different story because in recent years boat builders have ignored the standard that calls for all seacocks to be in readily accessible locations because seacocks are "ugly." Vessel safety has taken a back seat to decor...so they put 'em in totally inaccessible locations--under berths behind drawers, in settees where they become covered up with stored items etc...all but impossible to get to, even in an emergency.So the only viable solution is an owner-installed shutoff valve in the head intake line that IS readily accessible--right next to the head that can be kept closed except when actually using the toilet. It won't keep your boat from sinking if the hose connection at the seacock fails, but it will keep your bowl from overflowing while you're underway. If the bowl also fills up while the boat is at rest, it means that water outside the boat is seeking its own level inside the boat....and relying on the wet/dry valve to prevent it can sink your boat, 'cuz wet/dry valves fail and people don't always leave 'em in the dry position either. Open head seacocks are the #1 cause of boats sinking in their slips. The cure: a vented loop in the head intake (it goes between the pump and the bowl, not the between the thru-hull and the pump) that's at least 8-12" above the waterline at any angle of heel. The loop creates a "hill" that's higher than the waterline...the vent in it is a siphon break that prevents water flow started by priming the pump from continuing to flow. A vented loop will NOT stop "ram water," however. So unless the seacock is in a location that allows you to keep it closed, both the shutoff valve and the vented loop are needed to cure both problems.