Both unfortunate and I understand your disappointment. I had a somewhat similar situation when my mid-2016 MS90D was only about 2 months old. Was driving and in must a matter seconds had multiple messages pop up about front motor drive torque reduced, pull over safely, PRND display going red, and coasting to side of road. Was diagnosed at the time as "rare software bug" and the car returned to me.
What my service team did tell me after the first event was if something like this happens to get out of my car, walk 20-30 feet away (out of key fob range), let the car lock and shut down. Wait about a minute or so, then approach car, unlock it, and get back in. Most of the diagnostics are reset to run again on initial start-up. If it's a borderline fault condition you may find that car will drive fine, at least allowing you to get back home to arrange service in likely a more convenient setting than sitting at the side of the road.
Now my car did repeat the exact same situation about about 20 months later. I remembered what service told me, did exactly as suggested and did find that when I unlocked and got back it that it was fine. That allowed me to at least drive home and make arrangements to get car in for service in a fashion more convenient to me than being stuck on the side of the road (actually drove the car to service center, ~ 50 miles away, about a week later). That time they kept my car for close to a week and engineering reviewed all the data, did multiple troubleshooting exercises, but ultimately ended up replacing my rear drive motor.
Not suggesting your failure is same issue as mine; more wanting to relay the advice about exiting vehicle, shutdown, and potential this could reset diagnostics if case you ever encounter similar situation in the future.