I think the scripture says it plainly in Jn 6 as well as Mt 16:
If that is what you were saying that Peter understood: "You are the Messiah, the Son of the living God.” then according to your logic you are. also saying that Peter knew that Jesus could give his flesh to eat, whereas the others who went away and John 6 did not believe that Jesus could give his flesh to eat, because they believed he did not come from heaven, but Peter knew he was from heaven, so Peter according to your logic knew he could eat Jesus flesh and drink his blood.
That is your logic - people went away because Jesus was not from heaven and could not give them bread from heaven.
But, in fact, while Peter believed in Jesus, he did not know what Jesus was talking about until after the resurrection.
“Do you still not understand?” How often Jesus asks that question of the 12!
He asked that question in Matthew 16 which you quoted and then shortly after Peter made his good confession Peter shows that he did not understand again even though he said Jesus was the Christ.
Jesus told them that the crucifixion must happen to the Christ that Peter confessed him to be.
'Peter took Him aside and began to rebuke Him. “Far be it from You, Lord!” he said. “This shall never happen to You!”
But Jesus turned and said to Peter, “Get behind Me, Satan! You are a stumbling block to Me. For you do not have in mind the things of God, but the things of men.” ’
Peter believed in Jesus but he did not understand at all. And he got back behind Jesus and followed rather than trying to lead, and when the time came he took what Jesus handed to him and ate it and took the Chalice Jesus handed to him and drank from it, and after the resurrection understood what he had eaten and drunk.
John Martin