As the wise king wrote, “For everything there is a time, and a season for every goal under heaven.”
The “time for war” was when Canaan was simply a battleground for warring barbaric tribes, each competing to outdo the other in depravity. (By Chazal’s math, Rachav’s father started her in her prostitution career at age six!)
Hashem wanted us to bring civilization to a group of people who would only get there through fear and intimidation. And so, we were sent to beat up the equivalent of “the toughest inmate in the cell block.”
But we didn’t sufficiently stand for our cause, and instead of bringing progress to the region too many of us assimilated. Rather than set up rule of law, we set up altars to bribe Baal and Asherah with fatted sheep or tried to appease G-d the same way. And so, there were centuries of fighting. Rather than one quick period of conquest, followed by a more civilized region, peace, and less death and suffering overall.
No, I cannot know that the alternative history would have been more peaceful and moral. I am taking it on faith that Hashem, being fully knowledgeable about realities that could have been but weren’t, and knowing from the rest of halakhah the morality of his laws (“derakheha darkhei no’am — its ways are ways of pleasantness), I take the relative ease of humans building a better history through even these mitzvos as a matter of faith. My goal here is just to explain how that is possible.
Hashem eventually brought civilization to the area another way, through the Assyrian Empire. And notice He did so through Sancheirev’s policy of relocating vassal populations and erasing national identities. Which made these mitzvos of violence moot. The fact that the commandment and my explanation for the need of mitzvos of violence were both ended by the same historical event convinces me I am on the right track.
When the laws of Amaleiq and the Seven Nations would no longer be the least of evils for the course of regional history, they aren’t wanted.