It is highly unlikely that the sons of Jacob would have stayed together in Canaan. -> They were not good men. -> They were not committed to God.

The sojourn in Egypt served to keep them together so that they developed as a nation with a specific identity.,

Esau was a son of Isaac but he and his descendents did not stay true to the God of his grandfather Abraham as the two brothers separated their families geographically.

It has been said that the family that prays together, stays together. The ChildrenOfIsrael is an example of how a family that stays together, prays together.