This is a great question because the Bible does not give an answer as to whether Judas left the Last Supper before or after He instituted Communion as the sign of remembering the new covenant. Even more, it is a great question because you looked into the gospels for the answer.
We do have differing views of the Last Supper from Matthew, Mark, Luke and John. I think you will see that we can get a good picture of what was going on and that when Judas took the piece of bread from Jesus that it was definitely not during communion. Of course, there is more to find in these passages and some people have mistakenly felt that there is a contradiction here.
Matthew tells us that Jesus said, “The one who has dipped his hand into the bowl with me will betray me."
Judas had already dipped his hand in the bowl. Some time after this communion was given.
Mark tells us: "When evening came, Jesus arrived with the Twelve. While they were reclining at the table eating, he said, “Truly I tell you, one of you will betray me—one who is eating with me.” They were saddened, and one by one they said to him, “Surely you don’t mean me?” “It is one of the Twelve,” he replied, “one who dips bread into the bowl with me…"
From this we know that Jesus told the disciples ahead of time how they would know who it would be.
Luke is silent on the issue of when Judas took the bread and when he left. Luke just tells us that Jesus had communion.
John gives us some great insights into what happened: After he had said this, Jesus was troubled in spirit and testified, “Very truly I tell you, one of you is going to betray me.”
His disciples stared at one another, at a loss to know which of them he meant. One of them, the disciple whom Jesus loved, was reclining next to him. Simon Peter motioned to this disciple and said, “Ask him which one he means.” Leaning back against Jesus, he asked him, “Lord, who is it?” Jesus answered, “It is the one to whom I will give this piece of bread when I have dipped it in the dish.” Then, dipping the piece of bread, he gave it to Judas, the son of Simon Iscariot. As soon as Judas took the bread, Satan entered into him. So Jesus told him, “What you are about to do, do quickly.”
So we see that Jesus told the disciples that one of them would betray him and that person would dip his hand in the bowl with Jesus. John is reclining against Jesus and Simon Peter motions to John to ask Jesus which one. Jesus tells John that it will be the one that Jesus gives the bread to. We know that John heard the answer but we don’t know if anyone else did. Jesus dips the piece of bread into the dish/bowl and Judas must be close enough that he dips his hand into the bowl at the same time. Judas asks if he is the betrayer and Jesus confirms this and sends him away.
To your other question, communion was given for the first time at the Last Supper but it was just a part of that event. The Last Supper and holy communion are not interchangeable. Please note that I am not Catholic and am not trying to speak for the Catholic viewpoint.