My Ex used to have that happen from time to time and it was the silliest thing you could imagine.
She had a key chain with a crap load of stuff on it and it would get swinging and just switch the car off.
Also, I have had a number of cars that have had something go wrong that tripped the check engine light and put the car in limp home mode (the FSM will tell you which trouble codes put the car in limp home mode) and never has it shut the engine down and required a restart to drive it. That would be a law suit waiting for a place to happen if it was designed that way.