Sometimes it is necessary to eliminate undesirable elements even without exception, as they were possible threats to the Israelites intended long term occupation of the promised land; this was a common war tactic among most people throughout history but in the case of the Israelites, they were commanded by God to do so and God knows the past, present and future.
When God ordered the Israelites to execute His enemies of old who were worshipping the demons and practising the black arts, He commanded what was good and holy, for human life is not an absolute and, under proper authorisation, can be legitimately taken away from those who commit capital offences, amongst which are the spread of false worship and occultism.
God satisfied the requirements of ‘virtue ethics’ by commanding the death of these evil peoples with all the perfection and purity of His Most Holy Will. In His infinite Mercy and Goodness He cut short the increasingly wicked lives of these unrepentant souls (i) so that they would suffer fewer torments in the fires of Hell and (ii) so that the contagion of their evil practices (involving demon worship and human sacrifice) would not infect and kill the souls of His Chosen People.
God also satisfied the requirements of ‘utilitarian/consequential ethics’, for His holy objective was perfectly realized in practice: the Israelites DID conquer the land (miraculously and against all odds) and enter their God-given home, demon worship and sacrifices WERE expelled, and the next essential step in Salvation History, ahead of the coming of the Messiah, WAS achieved. All in all a resounding success, increasing God’s blessings not just for the Israelites but for the whole of mankind of which they were the prefigurement.
If God in His Omniscience had perfect knowledge of the irredeemable wickedness of the Canaanites and the even greater sufferings they would merit for eternity in Hell were they to be allowed to continue along their path of evil, was it not merciful of Him to spare them these additional torments?
Does not God see everything before Him - past, present, future? Does He not have perfect knowledge of men’s hearts and their just deserts? Are we more far-sighted, more just, more compassionate than Almighty God Himself?