I really liked Stanisław Lem's take on this in the short story "The Tale of the Computer That Fought a Dragon".
https://www.oocities.org/stanislaw_lem/opowiadania/opowiadan...
A solution for a military AI gone awry that built a terrifying electro-dragon was obviously to build a super-electro-dragon.