Anon: It's interesting how genocide is the 'lesser of two evils' between it and polytheism. Good to know.
VR1: Yes indeed. In order for God to save the world through Christ, there has to be a nation of people committed to the idea that there is one God who demands righteousness. The Canaanites, et al, if allowed to live, would have seduced the Hebrew people away from the worship of Yahweh. In fact, they did seduce many Hebrew into idolatry. If all the Hebrews had become idolaters, then God would not have had a nation of people to send Christ to. As Mr. Spock says, the needs of the many (for Christ) outweigh the needs of the few (the Canaanites, Amalekites, etc.), so they had to be slaughtered.
VR2: Why do I not like saying this sort of thing? After all, according to a well-known secular ethical theory, utilitarianism, an act of any type can be right if it maximizes the total balance of pleasure over pain, up to and including genocide. Nevertheless, my reply seems a little glib.