The Outer Space Treaty of 1967 is an outmoded piece of paper written by and for people from a different age. It needs to be replaced, but that won’t happen without a political challenge (such as this one).
Even then, your argument that the ability to shield against solar flares and asteroid strikes would require weapons platforms, or technology that could be dual use, is flimsy at best. It seems to be based entirely on the idea of the peak and cumulative energy that would be required for such feats, but energy in of itself is not a weapon. Don’t demonize technology before it even exists.