Confession can be done anywhere, as long as the absolution is done and with a Priest, of couse. Privacy is highly preferred of course, but he may have been concerned that there wqs a mortal sin on their soul to remove before Mass.
While I’ve gone to confession in a couple of strange areas (like our parish cafeteria, which was empty, of course) and my patron, St. John Bosco, used to hear confessions behind a tree, the key element is privacy. I’ve even gone to confession in the sacristy closet just prior to Mass. Privacy is, I beleve, more than highly preferred. It is integral because of the secrecy of the confession. Remember, priests have died to protect the integrity of the confession (the martyrs of the Mexican Revolution come to mind).
Now, during Communal Reconciliation services, we’ve had confessors and penitents use the sacristy, the sanctuary, the baptistry, and the back chapel (which we only use for Holy Thursdays) in addition to the two confessionals. Yes, we do have good attendance during Advent and Lent, and, right before Holy Week. All the same, confessors are very careful about maintaining privacy. What I thought was most moving was to see the confessors going to each other for confession (after the crowds wound down). I would like to see our current bishop take part in something like this because, as I see it, if the Holy Father can hear confessions once a year, why not our local ordinaries?
So, what the priest should have done was excuse himself and the penitent and move down the pew to a more quiet place. That happened to me over the summer and the visiting priest waited until the stragglers left after Mass and heard my confession.
I do have a funny anecdote. About 20 years ago, my mother (who has since died) needed to go to confessoin prior to Mass as she was going to help the disabled confirmandi. She went into the sacristy and found our Bishop. The Bishop asked if he could help her, to which my mother replied, “Well, I was looking for a priest to go to confession.” The Bishop laughed and asked her, “Would I do?” Needless to say, he heard her confession in the sacristy. When she came out to the church, she looked very relieved. With some embarassment, my mom relayed her pre-confessional conversation with the bishop, but not what was said in confession.