It does already exist... There are many companies offering these all with varied way to implement it. As
@MossRoad mentioned Water Cop has been doing it for close to 20yrs. Their Pro system includes the main water valve, controller, probe sensor. You can add additional supervised wireless sensors or hardwired sensors to monitor multiple areas (hot water heater, well tank, washing machine, etc). When the a system senor detect water it relays to the controller which turn the main water ball valve off.
This is also designed to tie into a home security / monitoring system or home automation controller for remote notification.
Water Cop:
NEW HOME 2019 - Watercop
Another company is Fortrezz (they have a remote app):
FortrezZ
There are a bunch of others out there also but these are two of the ones we have used on clients homes...