I use an ELK-9200 Heavy Duty Relay/Contactor to shut off power to my well pump whenever a water leak is detected. It should work well for your application.
Here’s an article about controlling a water heater using the ELK-9200: https://www.elkproducts.com/automating-the-water-heater/
Even with my water pump turned off, my well expansion tank will continue to supply water to my house until the internal bladder pressure reaches zero. This article describes using a ELK-WSV2 to immediately shut off the flow of water (as opposed to just turning off the well pump): https://www.elkproducts.com/dont-get-washed-away-by-water-leaks/