Are the gates of the Holy City in Revelation 21 and 22 the demarcation line between two different groups of people?
You are correct to observe that often the imagery of being in or outside of a city wall means the difference between being in relationship or not. In the Gospels, study out "cast into outer darkness" and what that means, in regard to the walls and gates of a walled city. And look just how big the walls of this city are! The city is secure from the evil ones.