But we don't know whether this happened or not. I'm pretty sure Starfleet would've extensively tested the M-5 before putting it on a ship.
If the M-5 works under actual conditions as well as it has under simulated tests, it will mean a revolution in space technology as great as warp drive.
But clearly M-5 knew it was working in a simulator. They should have caused M-5 to mistake the simulator for the real thing. Then it would have shown its true colors, its true engrams I mean, sooner.
No, wait. They may well have let M-5 think the simulated tests were real, but within those sims, the unit was supposed to fire full phasers. And then aboard the Enterprise when told to play nice, it just refused to pull its punches-- this was a condition they never simulated. Interesting.
Now Starfleet has to explain the deaths of over 500 spacemen in peacetime. That goes beyond mere courts-martial and into the realm of a government changing hands in the next election.