What’s wrong with the Egyptians? What’s wrong with the Canaanites?
The answer is deduced from the words which follow: “Perform My judgments, observe My statutes”. God’s ways are just and ethical. Not so the Egyptians and Canaanites.
It’s not that Egypt and Canaan did not have attractive features. The Egyptians in particular had a high standard of civilisation.
But the way to assess whether to emulate their example has nothing to do with their material civilisation but depends on whether they were governed by judgments and statutes that stood for the rights and dignity of all citizens, not favouring the rich or the mighty, not cowering before demagogues who had a loud voice, not being susceptible to flattery or grandiloquent promises.