You can buy those as independent devices, however they’re not ‘smart’, or at least not as smart as I presume yours to be. The ones I’ve seen have the water running through them, but also have the washing machine plugged into them. They keep an eye on the power and only open the valves when there’s enough power being drawn by the washing machine that it’s safe to assume it’s running. This is, more or less, what I’ve seen, but I’m sure there are different brands/models with different features.
I had almost that exact same experience. I happened to wake up in the middle of the night and had to go to the bathroom. As I was wandering back to bed, I stepped in something wet, which to this day, I tell myself was a puddle of melted snow and totally not dog pee. In either case, I had stopped to deal with that and by the time I was done, I noticed the toilet was still filling. After about 2 minutes of letting other noises in the house stop, like the furnace and make sure the toilet wasn’t actually filling, I stumbled down to the basement. The basement, to my surprise, was loud and absolutely filled with steam (and I thought it was smoke at first). Eventually I could see water pouring out of the bottom of it. I can remember half my brain wanting to panic and the other half thinking ‘calm down, figure this out, go back to bed’. So I shut off the gas and water inlet and outlet on the water heater, went back to bed and replaced it in the morning.
I got lucky in that the leak was in a spot where it was contained by the outer case of the unit. Wherever it was originating, it was pouring directly out the bottom and not, say, spraying across the room.
Even more lucky is the fact that the water heater is about 2 feet from a floor drain, so there wasn’t any damage either. In fact, by morning you really couldn’t tell anything had happened. My washing machine is just as close and one of the reason I don’t replace the hoses as often as I should is because I know (assume/hope) if one breaks there’s just not a whole lot of damage it can do in a room made mostly of concrete.
However, one thing I do keep in mind is what’s on the floor in the area around the drain (and the path from water sources to the drain). My neighbor had, what should have been, a very small amount of water in their basement from a heavy rain. But the water, on it’s way to the floor drain, picked up an old door mat and carried it to the drain where it sealed itself to the drain opening and allowed their basement to start flooding.