You can train for emergencies until the cows come home, but until you are facing a real one you don't know how you'll react. Maggie did an exceptional job.
That is correct and of course one cannot cater for everything that can go wrong, but pilots are extensively trained for the most usual failures they will encounter, for light aircraft pilots in Australia (when I learned to fly anyway) this includes engine failure and loss of visual reference to the ground (a VERY serious problem that does not at first glance seem like it).
The instructor I had went well beyond that particularly on the correct "mind set" to one: avoid failures and two: how to handle a random failure. This extra training help me NO END when I had two separate undercarraige lowering problems (Note 1).
Note 1: In both cases I managed to solve the issue without having to declare an emergency.
All aircraft extensively use carefull worked out check lists, for EVERTHING one needs the aircraft to do. These checklist have been based on past experience on accident causes. A current example of a checklist update was after the accident that killed the golfer Payne Stewart. All business jets checklists for a cabin air pressure alarm were checked to make sure the first item was "put on oxygen masks". In the Lear jets at the time of the accident this command was 3rd on the list and by the time the monitoring pilot got to the third step the air pressure in the cabin had drop enough to scramble the pilots thinking.
Airline pilots spend extensive time in simulators on a regular basis constantly practicing various types of failures.
As you say Maggie did an excellent job and there would not be a pilot in the world that does not think this.