Things that go around, come around. The Torah exemplifies this concept writ large – events that are described in Genesis, end up having counter-events much later in the text.
Take, for example, Sarai’s maidservant, Hagar. She is described as being Egyptian, and she is in servitude to her mistress (the Torah connects, ad nauseum, her name with her status). Her mistress treats her badly, and Hagar first flees, and then is later sent away by Avraham himself.
The Torah describes mirror events, using the very same language, for the Jewish people regarding their time in Egypt! This time it is the Jews who are servants, and who are mistreated by their masters.
The Torah tells us that the Jewish people fled, barach, from Egypt. It uses the very same word to describe Hagar’s flight!
And there is a powerful comparison here as well:
Early next morning Abraham took some bread and a skin of water, and gave them to Hagar. He placed them over her shoulder, together with the child, and sent her away. (Gen. 21:14)
So the people carried their dough before it was leavened over their shoulders. (Ex. 12:34)
One balances the other. Considering that the Exodus was foretold to Avraham, it makes sense that the hardships undergone in Egypt were, to some extent, corrective for what Avraham and Sarai put Hagar through!