Tommy Hodgins Rewrite it in Rust :D
I'd rewrite Linux in Rust and only allow Rust code to interact with it. That would guarantee at least basic memory safeties. Many big bugs of the past years wouldn't have happened (I am looking at you, Heartbleed). Also, dependency hell would be a lot more manageable (thanks to cargo).
Well, apparently I am not the only one who would do so; that's why I am watching the Redox project closely :)
I would rewrite Windows, so it was native to bash, creating a global wrapper for anything with the purpose of configuring, communicating and translating packages of software developed through it. Cross-platform bliss that takes advantage of custom hardware.