Peter and Barnabas and the others were being two-faced when they withdrew from eating with the Gentile Christians. They were saying one thing with their actions and believing another in their heart. They sought to avoid censure from the circumcision party at the expense of their principles. They feared what man might do and so they put up a front. That is why it is so out of step with the gospel.
Insecurity is inconsistent with the gospel.
When you feel insecure or frightened and are tempted to put up a front and avoid taking a stand for what you believe is right, the battle you are fighting is a battle to believe the gospel . But more than that the sheer beauty and power of Christ's resolve to suffer for me instead of putting up a front to save his skin, shames me in my fear of man and my inclination to play the hypocrite in order to avoid suffering. Center your life on Jesus and his gospel and the root of hypocrisy will be severed. Legalism is out of step with the gospel. When you as an apostle cut off table fellowship with Gentile brothers and sisters because they don't keep dietary laws and you take Barnabas and all the Jews with you, the Gentile believers cannot escape the impression that they are not fully Christians unless they become Jews.