No, the Berlin wall was to keep E. Berliners inside E. Berlin.

The Israeli wall is to keep terrorists out of Israel.   There is a big difference.

And the wall between the U.S. and Mexico?   Well, it's not to keep Americans inside the U.S.

By the way, the wall around the Vatican?  It was built in the 800s to keep Muslims from storming the Papal HQ.   

Pope Leo IV began to take precautions against a repetition of the Saracen raid of 846. He put the walls of the city into a thorough state of repair, entirely rebuilding fifteen of the great towers. He was the first to enclose the hill by a wall. The walls that Pope Leo built, which were completed in 852, were nearly 40 feet high, twelve feet thick, and defended by dozens of towers that turned the site into a fortified city.

So the idea for a wall goes back to the Church.   And given that the Vatican's walls are 1300 yrs old, walls  seem to be a good idea.