Yowch!

Well, I guess there are lots of situations my imagination fails me on.

I can easily see how you could flip if you end up sideways, cuz once the wheels start scrubbing and stop rolling, momentum would have a way of trying to continue in your previous direction....
I guess if it was a leaning trike it would have a lot less tendency to end up in that position, possibly even able to recover from a complete sideways spin, like a bike can (with a skillled enough rider), with the rider's weight being able to lean over the other way to try to counter it. But on a regular trike you just can't lean far enough while still keeping the weight/force on the contact patches of the right tires and letting them pivot the weight around, so it could just catch and flip easily.
I'm not sure how to prevent ending up sideways, though, except with some sort of traction control system that brakes all the wheels automatically in the event of one failing to rotate as fast as the others, but braking each one independently in such a way as to maintain traction on them all and try to match their speeds, ceasing to brake when all wheels match speed again.
I have very little idea how to do that, as it would require a long list of conditionals in the controls, so it doesn't happen in turns or during deliberate maneuvers by the rider, but does happen in loss-of-control situations.