"When Pharaoh let the people leave, God did not lead them along the Philistine Highway, although it was the shorter route. God's consideration was that if the people encountered armed resistance, they would lose heart and return to Egypt."
It was bad for the Jews that Pharaoh let the “people” - meaning the mixed multitude of slave nations – go with them, since it was because of them that God did not pity the Jews and did not bring them directly into Israel. Rather, God considered that “people” - that is, the mixed multitude - would change their minds and return to Egypt.
When Moshe saw that they would be forced to go through the desert, in the direction of the Sea of Reeds, and will have to cross it, he took the remains of Joseph with him, so that Joseph would help him split the sea, as the verse “the sea saw and ran away” implies.
The Philistines are spiritually compared to hair, and their verse is “hanging hair locks,” with the accompanying spiritual affinity to Leah. The Jews now needed to go to Israel, which is connected to the qualities of Rachel, and the danger was that when going through the land of Leah, they would get stuck and go back to Egypt. Moses, who represents the Foundation of the Supernal Father, was on a level that is too high and abstract. He could get to Israel only through the Foundation of the Cosmic Man, which is represented by Joseph. He thus took the remains (literally, the essence) of Joseph, clothed himself in the Foundation of the Cosmic Man, and thus was able to direct toward Rachel – Israel.
Art: (Jacopo Carucci) Pontormo - Joseph in Egypt