Jesus existed before his birth and saved the people of Israel from Egypt. Later, he punished those who were unfaithful (compare 1 Corinthians 10:4).
after Jesus had delivered His people out of the land of Egypt, He destroyed those who did not believe: Most people did not trust God to keep them safe. Because they did not believe, God made that generation (except Joshua and Caleb) wander in the wilderness until they died (see Numbers 14).