There was a Star Trek episode that addressed this issue of a giant computer controlling drones that were built as weapons, but which were no longer under the control of the humans that built them. I think it was the original series.
Star Trek: That Which Survives
Beautiful robot set for individual target.
https://m.youtube.com/watch?v=1JddCZEd07I
Actually, I think that was a Next Generation episode.