It wasn’t a private matter because it did not happen in private between Peter and Paul.
KJV
Moreover if thy brother shall trespass against thee, go and tell him his fault between thee and him alone: if he shall hear thee, thou hast gained thy brother.
NIV
15If your brother or sisterb sins, go and point out their fault, just between the two of you.
But you need to consider, Paul was telling the Galatians, who would not have not known anything about it much less been involved, so slander is what it actually was.
Who would not have not known ?????????
Yes, if your brother trespasses against you, do go to him privately. But this was not a private action on Peter's part. it was done publicly and his sin involved other Christians.
Peter did not trespass against Paul. He trespassed against the whole church and it needed to be dealt with for the people he hurt.
What is so hard to understand about that? You recall, that the Holy Spirit slew Ananias and Sapphira PUBLICLY for a sin they sinned privately, don't you?
The Holy Spirit saw fit to include the Peter and Paul episode in the Scripture HE breathed out.
Peter was wrong and called on it and the church needed to know how to properly deal with public sin like that.