When God judged the Canaanites through the Israelites, He gave the Israelites a warning:
But if you do not drive out the inhabitants of the land from before you, then it shall come about that those whom you let remain of them will become as pricks in your eyes and as thorns in your sides, and they will trouble you in the land in which you live. And as I plan to do to them, so I will do to you (Numbers 33:55-56).
It's the last sentence of this that clues us in as to why, in addition to the reason of the deserved judgment against the Canaanite culture, God wanted to drive out the Canaanites. If the Canaanites remained in the land, they would "trouble" the Israelites. And we know from the last sentence what "trouble" means: If their being "troubled" would lead to God judging the Israelites as He did the Canaanites, then being "troubled" means that having the Canaanites there would cause Israel to commit the same sins the Canaanite culture encouraged. The misery that would follow from Israel being immediately swallowed up by the evils in the Canaanite culture would be devastating.
God had to drive out the Canaanites because He was building a culture that would bless the world. Culture is more powerful than most people realize. The practiced and accepted sins in a culture pull at everyone, and it's almost useless to try to resist. Just as in the case of the Flood, in order for God to start anew, He had to protect His invaluable seedling from the giant and aggressive weeds of child sacrifice and other evils that threatened to destroy His small and growing blessing for all future generations. A wall had to be built to allow the Covenant time to shape a people who would bring us the Scriptures and the Messiah.
But despite the warnings, and though they had the Law, the Israelites failed to completely drive out the Canaanites, and they ultimately did adopt the Canaanite sins, bringing on themselves their own judgment of destruction and exile.
And in the process of this unfolding of God’s work among men from creation to the cross, God revealed to the whole world the depth of our weak sinfulness and just how desperately we need Him. We human beings simply cannot be righteous on our own and fulfill our purpose of loving and reflecting God.
We couldn't reflect God when God Himself walked with us and we could see perfection.
We couldn't reflect God when we had no law.
We couldn't reflect God when we had a beautiful Law.
Fail, fail, fail. Enter Christ. What was left but for God to return not only to stand among us, not only to free us from the Law, not only to reveal His perfections (the standard behind the Law) more clearly than even the Law could, but to dwell within us, changing us and empowering us from within, and to stand in our place as the righteousness we failed to achieve?
And so in the end, after the depth of our inability to be righteous on our own had been revealed, and after God’s righteous judgment—past, present, and future—was made plain, Jesus came and “purchased for God with [His] blood men from every tribe and tongue and people and nation.” This was no mere tribalism; what began as a focus on Israel was always intended to end with the world.