One of the more obscure and curious events that occurs in Parshas Shemos is the encounter at the inn at Shemos 4:24-26
Part of the answer, as it often does in the Torah, lies in simply reading the Psukim in context, even though the action seems to jump around wildly. Going back two Pesukim we read:
Obviously the nearness of this is not coincidental. Right after G-d tells Moshe to tell Pharaoh that if he does not free the Jews to serve him, he will be punished with the death of his own son, Moshe himself faces death at the hands of G-d. While Moshe is not a first born son himself, it is because of his son who was not circumcised that this took place.
What does circumcision mean? It means the entry into the service of G-d through the Brit, the covenant that had been first made with Avraham. After Moshe had been told to declare to Pharaoh that either Pharaoh would release the Jews to serve G-d or his son would die, Moshe was now being held to the same standards, facing punishment because he had not inducted his own son into the service of G-d.
This still seems overly harsh, but there is still more context. Moshe had two sons, Gershom and Eliezer. Yet Eliezer's name is only mentioned in Parshas Yitro Perek 18 Pasuk 1 and not mentioned originally, only Gershom is. Of course this would reasonably be because Eliezer was the youngest, so young he might not even have been named when Moshe set out on his trip to Egypt. Thus the son on whose account Moshe nearly died was likely Eliezer.
Now what is the significance of their names? Gershom, we are told was named because of Moshe's exile, 'I have been a stranger in a strange land.' Eliezer by contrast was named in gratitude to G-d 'for the God of my father was my help, and delivered me from the sword of Pharaoh.'
Gershom's name could be taken as a form of complaint over Moshe's exile. Eliezer's name by contrast is a paean of gratitude to G-d for his salvation. Thus it was Eliezer's lack of circumcision that drew G-d's anger at the inn, for with his name Moshe had acknowledged G-d's role in saving him and his failure to bring this son in to the Jewish people made it all the more outrage. Had it been Gershom, a child named after his exile, it might have been understandable, but a child named Eliezer requires a higher standard.
We see something similar with Yosef, who named his sons Menashe and Ephraim. Both Menashe and Ephraim's name referenced G-d, but Menashe' name expressed thankfulness for leaving his troubles behind him 'for God hath made me forget all my toil, and all my father's house.', while Ephraim's name expressed gratitude to G-d for his fruitfulness in Egypt, 'for God hath made me fruitful in the land of my affliction.'. And when it came time for Yaakov to bless the two sons, he placed Ephraim before Menashe, the first born. After all it would have been inconceivable for Yaakov to give primacy to the son who had been named after his father's relief at leaving Yaakov's house behind.
Names after all are not purely random, among such people they represent the wishes and the mindset of the parents that will raise the child. On Menashe's birth, Yosef had been happy to leave the troubles of his father's house and slavery behind and settle into the task of ruling Egypt. And so Menashe grew up to became his father's second in command who oversaw his house. By the time Ephraim was born though, Yosef had recognized that Egypt was still exile and still his land of affliction, even now that he all but ruled Egypt and so it was Ephraim who would have the greater destiny of the two sons.
Of Moshe's two sons though little is heard. Why? Because Moshe sent them both back and only when Yitro arrives, before or after the giving of the Torah, do they rejoin the Jewish people. Moshe had shown a lack of faith in not bringing them down to Egypt as he had shown a lack of faith in not circumcising Eliezer immediately. As a result both his sons were not present at G-d's redemption and therefore Moshe was not able to have his wish fulfilled that they might lead the Jewish people after his passing.