Rather than hook the M-5 unit up to the Enterprise and give it "varchully unlimited power!", Starfleet should have tested M-5 by linking it to another computer-- a virtual simulator that the M-5 thinks is the real deal. The Enterprise, outer space, and other starships would all be simulated in the virtual environment.
Starfleet officers would log on and play the game as if they were on their real ships, and only M-5 wouldn't know it was a virtual environment. Then when the unit went crazy and started killing people, all the lessons could be learned and nobody really dies.
A very sensible plan that should have been carried out, but never was.
My guess as to what happened to Daystrom is that he was 'rehabilitated', was able to get his life back on track, and came up with positronics, but died before he could implement it, leaving the work to a young acolyte, Noonien Soong, (who had already been working on this from another angle based on work from an ancestor).