God never said that He would punish Israel for not going into the wilderness to worship Him. Further, God predicted that Pharaoh would not let the Israelites go (cf. Exodus 3-4). Thus, the nation of Israel begins her history of not fully listening to God, but only hearing some of what God says, and complaining against and persecuting those God sends to her to bring His pronouncements. God’s prediction came true and Israel complains against Moses.
Pharaoh knows the gods of Egypt, or rather he knows about them because they cannot be known. He knows the stories and the power that has been attributed to each one. He probably prays and sacrifices to them in order to try getting what he wants. He does not know Yahweh, the I Am—the only true God. God has already made His plans to conquer Egypt known. He will humiliate the Egyptians’ belief in their false gods. He will make Himself known with power. God will not punish Israel for not making it out. He will come against Egypt for not letting the Israelites go so that He may be recognized and feared in Egypt—eventually making Egypt His people with Israel (cf. Isaiah 19:23-25). As is often the cased with us as human beings, Israel does not realize that God’s purpose is grander than one nation. He is not merely the god of Israel, for what god is so limited? He is the One true living God, master of heaven and earth, and creator of everything. He is Lord of all people whether they know Him or not. His plan involves all nations—which are to be blessed through Israel (cf. Genesis 15). The people of Israel are as we all often are, shortsighted.
Therein lies our challenge. God is doing something bigger than us. May we not be entitled or think that His end lies with a single person or nation. If our persecution means the advance of His name among the nations, so be it. Look at the evidence. In Genesis 5, Pharaoh does not know God’s name. In our day, the whole world knows God’s name and talks about His Messiah—Jesus Christ. God is doing great things. He is conquering and saving the whole world.