It won't end the world because AI doesn't work the way that Hollywood portrays it.
No AI has ever been shown to have self agency, if it's not given instructions it'll just sit there. Even a human child would attempt to leave room if left alone in there.
So the real risk is not that and AI will decide to destroy humanity it's that a human will tell the AI to destroy their enemies.
But then you just get back around to mutually assured destruction, if you tell your self redesigning thinking weapon to attack me I'll tell my self redesigning thinking weapon to attack you.