Keep the context in your understanding:
When did Peter start sinning and when did Peter repent?
Matthew 16: 22 Peter took him aside and began to rebuke him. “Never, Lord!” he said. “This shall never happen to you!”
23Jesus turned and said to Peter, “Get behind me, Satan! You are a stumbling block to me; you do not have in mind the concerns of God, but merely human concerns.”
Jesus hits Peter in the middle of his sinning spree, with a prophesy.
What should Peter have done right then? How about fall on his face, repent and ask for forgiveness?
Look what follows: Peter is ordered by Christ three times to stand watch yet falls asleep (which in the military is punishable by death), Peter takes one of two swords, draws the sword without being ordered to and swipes an ear off without being ordered to, which in the military are all death penalties. In the end (which has also been prophesied) Peter runs away.
All of Peter's actions show he is operating on his own (sinful) carnal wisdom and Peter has not repented, yet.
Jesus just looking at Peter after Peter denied Him three time (because of Jesus' prophesy), brings Peter to his knees.
This is pretty much standard operating procedure.