The resettlement to Egypt and 400 years of slavery was part of God's covenant with Abraham in Gen 15:13-14. Why do you think that would be part of God's plan for Israel? This seems harsh for His chosen people.
One explanation is that God wanted Israel to be a pure culture, devoted to Him. Most of the influential surrounding cultures were pagan. Shepherds were detestable to the Egyptians, so sending the Hebrews to Egypt ensured their isolation. Slavery compounded that cultural isolation. 40 people of Israel into Egypt, 1.5 million out. The nation of Israel had 430 years to establish their size, traditions, and common culture before God gave them the challenge of interacting with the pagan clans of Canaan.