“And Moshe took the bones of Yosef with him: for he had laid an oath on the children of Yisra᾽el, saying, God will surely visit you; and you shall carry up my bones away from here with you. Shemot 13:19.”
The Hebrew word for “bones,” as in “you shall carry my bones away from here with you,” is “etzem,” which also means “essence”:
“Know that there is certain bone-Etzem–עצם in a person’s spine called the ‘Luz–לוז.’ This is the essence-Etzem–עצם of the person, and is his primary root and source. It is the primary source of a person’s birth, in his heart, in his brain, and the source of seed. This essence-Etzem–עצם is from the choicest and most refined aspect of the seminal drop, and is the primary aspect that sustains all one’s bones-Atzamot–עצמות. When a person dies and his bones decompose and rot, that essence-Etzem–עצם does not decompose, nor does it disintegrate. If it is placed in fire, it will not burn, and if it is placed in millstones, it will not be ground up, and if it is struck with a hammer, it will not splinter. That essence-Etzem–עצם is sustained eternally, and after the death of the righteous-Tzaddik, it receives the power of pleasure and delight, as it states, ‘[He] will strengthen your essence-Atzmotecha Yachaleetz–עצמותיך יחליץ.’ In the wicked, this aspect receives will not lie with the mighty…] for their iniquities remain upon their essence-Atzmotam–עצמותם.” The root and source of this essence is the ‘Essence of the Heavens-Etzem HaShamayim–עצם השמים,’ and from there it receives strength to sustain and uphold a person’s entire body.” Peninei Halakhah, Shabbat 7:7:4, Yeshivat Har Bracha, Sefaria Edition.
So when Yosef made his descendants swear an oath to bring his etzem up from Egypt, he was not just speaking of his dead, corporeal body (which would not have decomposed, because Yosef was a Tzaddik). Rather, Yosef’s bones, as he used it in this verse, is that what made Yosef, Yosef. And that is Yosef’s perfection of the divine attribute of Yesod, which is connected to maintaining the purity of the holy bris. Since Yosef’s soul originated in the Sefirah of Yesod, he was uniquely qualified to begin the process of redeeming the fallen sparks (souls) of Olam HaTohu, which originated from a blemish in the place of the holy covenant, and which vastly outnumbered the actual Children of Israel at the time of the Exodus. See, e.g., Megaleh Amukot (Vayigash).
Yosef – whose name means “he added” – added these souls – the souls of the erev rav – to the group that would eventually become the Jewish people. In making his descendants swear an oath to bring his bones/etzem with them when they left Egypt with Moshe Rabbeinu, Yosef was enjoining them to bring the erev rav with them, which Moses did, despite G-d’s warning.
All of this accords with the view of Rabbi Pinchas Horowitz in Peirush Hafla’ah On Pesach Haggadah, Magid, First Fruits Declaration, Sefaria Edition. Rabbi Horowitz states that the oppression and enslavement of the Israelites was an attempt to keep them from removing the Divine sparks that were in Egypt. These sparks gave power and vitality to Pharaoh and all Egypt. The erev rav, the mixed multitude that left Egypt with the Israelites were invited to come along because some of the divine sparks were still residing among this group. That’s why the Egyptians hid Yosef’s coffin in the Nile, because they knew he’d laid an oath on his descendants to bring his bones away from Egypt with them when they left: they wanted to keep the holy sparks from leaving Egypt.
In ordering all of the male babies in Egypt to be drowned in the Nile, which the Egyptians believed to be the source of life and fertility, P’aroah meant for the Nile to digest the holy sparks contained within them. In like manner, P’aroah intended the Nile to absorb the holy sparks attached to Yosef’s bones/essence by submerging his coffin in the Nile. In this way, the sparks of Olam HaTohu which had attached themselves to Yosef haTzaddik would remain in Egypt and would continue to provide the land with vitality and sustenance.