Why did He do what He did?
He learned obedience. The first son fails, the second succeeds, the first Adam fails, the second succeeds. The first Israel fails, the second succeeds. It's a very Jewish motif.
The first Israel fails in a way that is mentioned several times in the OT AND THE NT. She forgot the great works God did.
Psalms 78
42They did not remember His power--the day He redeemed them from the adversary,
Psalms 106
21They forgot God their Savior, who did great things in Egypt,
Hebrews 3
19So we see that they were not able to enter because of unbelief.
Why was it important for her to remember these great works? Because Moses reminded God that it would be difficult for human beings to leave serving selfishness to serve selflessness, without great reassurances.
Exodus 4
1Then Moses said, “What if they will not believe me or listen to what I say? For they may say, ‘The LORD has not appeared to you.’” 2The LORD said to him, “What is that in your hand?” And he said, “A staff.” 3Then He said, “Throw it on the ground.” So he threw it on the ground, and it became a serpent; and Moses fled from it. 4But the LORD said to Moses, “Stretch out your hand and grasp it by its tail”—so he stretched out his hand and caught it, and it became a staff in his hand— 5“that they may believe that the LORD, the God of their fathers, the God of Abraham, the God of Isaac, and the God of Jacob, has appeared to you.”
But Christ remembered all the great works that God did, and learned that He needed to do them too, to bear fruit.
Hebrews 5
8Although He was a Son, He learned obedience from the things which He suffered.
Because He was the prophet that Scripture predicted would come, who was just like Moses, who would lead his people out of selfish living, by doing the great works, that the Father commanded him to do.
So also, you should remember the great works that God did in your life, to free you from selfish living. And live to manifest those great works to others, who are bound in futility, bound in serving selfishness, live in darkness, just as you once lived.
There is a certain way to know if you are saved or not: if you bear fruit. Become the spiritual father to those who leave selfish living. Here, in this earthly existence, whilst in the body.