There is a difference between rebuking and mocking. Paul did not verbally attack Peter in a childish way and call him names or poke fun at him, though.
Christians are not supposed to mock others. For It is written...
Matthew 15:11 ESV
"It is not what goes into the mouth that defiles a person, but what comes out of the mouth; this defiles a person.”
Ephesians 5:4
"Neither filthiness, nor foolish talking, nor jesting, which are not convenient: but rather giving of thanks."
Proverbs 26:18-19 NIV
18 "Like a maniac shooting flaming arrows of death
19 is one who deceives their neighbor and says,
"I was only joking!""
Colossians 4:6
"Let your speech be alway with grace, seasoned with salt, that ye may know how ye ought to answer every man."
Ephesians 4:29 ESV
"Let no corrupting talk come out of your mouths, but only such as is good for building up, as fits the occasion, that it may give grace to those who hear."
Proverbs 18:20-21
20 "A man's belly shall be satisfied with the fruit of his mouth; and with the increase of his lips shall he be filled.
21 Death and life are in the power of the tongue: and they that love it shall eat the fruit thereof."
James 1:26
"If any man among you seem to be religious, and bridleth not his tongue, but deceiveth his own heart, this man's religion is vain."
Titus 2:7-8 ESV
"Show yourself in all respects to be a model of good works, and in your teaching show integrity, dignity, and sound speech that cannot be condemned, so that an opponent may be put to shame, having nothing evil to say about us."
Matthew 12:36
"But I say unto you, That every idle word that men shall speak, they shall give account thereof in the day of judgment."