The Gospels (Matthew, Mark, Luke and John, although in New Testament) are scriptures in which Jesus "fulfilled law!" Jesus gave us examples of how to live and showed us how He would give "Grace and Mercy" if or rather when we fall from Grace.
We are human who fight against "principalities" (Ephesians 6:12)! Therefore, I agree with Star, "He was afraid" (flesh)!
Jesus knew, prior to Peter's denial of Him, what he would do. Although Peter denied Him, Jesus told him in Luke 22:31-32 "...Simon, Simon, behold, Satan hath desired to have you, that he may sift you as wheat; (v32) But I have prayed for thee, that thy "faith" fail not. And when thou art converted, "strengthen thy brother."
The flesh is weak and Jesus knows this! Therefore, He gave us an example of how He treats us when we fall from Grace. Jesus told Peter in Luke 22:34 "...I tell thee, Peter, the cock shall not crow this day, before thou shalt thrice deny that thou knowest me." Although Peter denied that he would, he did, and placed a curse on himself thrice!
However, if we repent, as Peter did in John 21:15-17 (after Christ had risen from the dead), (v12) He (Jesus) asked them to "come and dine." Afterwards, in Verses 15-17, Jesus asked Peter "...lovest thou me.." three times and told him to "Feed my lambs/sheep" three times, thereby removing the self induced curse. Peter denied Him three times and Jesus asked him three times if "he loved Him" in which Peter responded "Yes" three times thereby removing the curse.
Notice also that Jesus asked Peter to "feed his lambs/sheep" three times in John 21:15-17 which fulfilled Luke 21:32 "...And when thou art converted, "strengthen thy brethren" which was done by Peter "feeding his lambs/sheep."
Case and point, Jesus gave us an example which shows us "when" we fall from Grace (for the flesh is weak), "if we repent," He gives us Grace and Mercy and remembers our sins no more! Thank you Lord!