I once built the Great Wall and subsequently had two barbarian invasions spawned "outside" my borders. In fact, they were trapped inside culture from three of my cities.
The game went on and I left them there. Eventually the entire gap was filled with culture, and the barbarians were all simultaneously teleported to inside the borders of - and right next to a city of - a neighbor I had just declared war on.
Hilarity ensued.