A truly intelligent..eapon system might read the manifesto of the opposing forces,
True.
The solution was described in the ABC Warriors.
Artificial patriotism.
The system is designed to believe its side is right and stimulated to feel valued and rewarded when it does it's job well. Call it "Artificial pride."
How you implement such strategies is left as an exercise for the reader