Theoretically that will work. Water flows out, the sensor activates, the alarm trips, sending you the warning message and cutting off the power.
I don’t know if American-style breakers support auxiliary addons - typical European-style breakers do. If so, a shunt release (a solenoid device that trips the breaker after being energized) added onto the breaker controlling the washer might be a better choice than a relay