This is what happened to quite a few people with the Toyota unintended acceleration issue. There was speculation that it was caused by bugs in the engine control unit. Officially the cause was found to be floor mats coming loose and holding the accelerator down. (I bought a new Toyota shortly after this and the dealer was very careful to show me how the floor mats worked and how to make sure they were properly attached.)

The brakes of a car in good working order should be able to overcome the engine and stop the car even if the engine is stuck at full power. But you have to do it decisively. Push the brake pedal to the floor and keep it there until you've stopped. What often happens is people are (very naturally) confused and not sure what to do, they'll brake but not hard enough, stop braking when it doesn't seem to work, try again, etc. This can heat up the brakes to the point where they're no longer effective enough to stop the car, and then you're really in for it.

I agree with what you said about brakes overcoming the engine. I've seen tests which show it works on even monstrously over-powered cars, but it can feel like it's not working and if the driver reacts wrongly to that, then it may no longer work.

I think stopping the power from going to the wheels needs to be an easy option. I wish there was more importance given to being able to easily do this.

I think the two options are shifting to neutral, or turning off the engine. I tested in a late-00s automatic BMW, and you had to hold the start/stop button for what felt like a very long time to turn the engine off if the car was in Drive. In an emergency, I think most people would give up long before it turned off. In that car, it was easy to change to neutral though, so I don't have a criticism about that design. What concerns me is cars with the same approach for the start/stop button, but where it is hard to get to neutral. I think in the Toyotas which had unintended acceleration issues, it wasn't easy/intuitive.

Edit: Another comment reminded me of something I forgot to mention above. You don't want turning off the engine to be the first resort because you lose power steering, and eventually, power assisted brakes.