You can’t hire a guy to work 9-5 in a slaughterhouse and not expect that to affect how he interacts with animals outside the workplace. The same principle applies in war. People can only sustain the cognitive dissonance introduced by combat situations for so long before it affects their character generally. The history of war is littered with seemingly good people with no prior history of unethical conduct who engage in heinous actions on the battlefield like rape and cannibalism. They didn’t start out as monsters. The battlefield did that.
If the Israelites actually slaughtered entire civilian populations of Canaanites, Amalekites, and Midianites, what impact would those actions have had on the individuals committing the atrocities as well as the national psyche? And all this to protect Israel’s moral purity?