What do you mean by Genocide? That is a modern term, so it is anachronistic to apply it historically. We may still think it a crime, but it is less clear cut. Genocide as an idea was only invented post WWII, and means the willful destruction, in whole or in part, of a group and/or their culture and institutions.
So based on this definition, is Genocide ever justified? I think it can be, for instance the Aztecs ripping out hearts, infant sacrifice amongst Carthaginians, the head-hunting tribes of New Guinea, Sati amongst the Rajputs, the Thuggee, or the Druids of the Celts with their wicker men to burn captives alive. Genocide in these cases is not only excusable, but fit and proper.
You can argue that they need not kill the entire population - which is true - but therein you run serious risks. For instance, Mexico struggled for centuries with pseudo-Catholic folk beliefs, like Jesus Malverde or Santa Muerte, that have roots in their Aztec past. This in part helped fuel revolution, gansterism, drug-running, etc. If the upper echelons of Texcoco had been destroyed as Tenochtitlan was, a more complete Genocide, the end result might have been very different. The English killed every single Thuggee they found - and it is extinct now, with no insidious effects to speak of that I am aware of.
Now the Ancient Israelites were not the most loyal of peoples in the Biblical narrative, and this whole thing is about purity. I mean, they sacrificed their children and whored after foreign gods, repeatedly. I can see an argument for a necessary violence, to keep the influence away to prepare the Israelites for their role in history. Abhorrent certainly, but perhaps necessary. I cannot really speculate on counter-factuals if things had occured differently, but wars were quite brutal back then in general. Think of the de-Nazification in Germany or the enforced Pacifism in Japan, otherwise we may have had another sets of wars in 20 or 30 years or so. The issue is more complex than people realise, even if we are granting a basic historicity to the narrative, which of course is a different matter entirely. The point is that God specifically chose the Israelites, and that they are apart for this purpose.