I think the question “Why did God want to kill Moses on his way to Egypt?” is flawed in its own way. The real question would be, why Moses nearly died on his way to Egypt. God isn’t a killer, he isn’t a murderer, he is there to lead, warn and punish. And for Moses to receive a punishment, he needs to do something wrong in the first place. We need to understand the context of the incident first. Egypt at the time, particularly Israel, was still under the grace of Abraham and Israel is blessed by God for no other reason than that the people there are descendants of Abraham. The most important part to note of Abraham is that God bestowed him one single rule, “Any uncircumcised male, who has not been circumcised in the flesh, will be cut off from his people; he has broken my covenant.” (Genesis 17:14). Circumcision is really a big deal, breaking it would be punishable by being “cut off”, not exiled, but eliminated.