Isn't this literally how every killer AI is created in fiction? The only way to protect humans is to kill all humans or something along those lines.