Joseph is blessed in Egypt, and through him Egypt is blessed - and he dies there with his family, and with the Egyptians who have become his friends. his own family meant this for evil, but God purposed it for good.
tho he died in Egypt ((Genesis 50)) his bones are carried back to the land of his father ((Joshua 24)) according to his will & command
so in the typology we have Christ giving his life in what is spiritually called Egypt ((Revelation 11:8)), after bringing them great blessing
and we have His body ((the church)) being later brought out of Egypt ((not by any power of its own!)) into the place purchased and prepared for it long ago by the Father
Happens inside man (not outside) like bondage and freedom covenants, both are only played by women (allegory,) one womb birth for mans flesh and blood that doesn't inherit, being woke up from inside is Christ that sleeps until its woke up.
Classic reading called secular history is never fulfilled just repeated.
Ecclesiastes 3:15:
“That which is, already has been; that which is to be, already has been; and God seeks what has been driven away.”