This effect, where something is globally stable, even though all the individuals that make it happen are unstable is sometimes described as "a forest whose contours remain the same, as the trees all change".
Consider this algorithm for an ant colony foraging for a good source of food (this behaviour has also been observed in ants searching for a new nest site):
for each ant in the swarm
if the ant is unhappy
run to a random ant
if the random ant is happy
follow it to its location
if the random ant is unhappy
select a location at random
if the ant is happy
the ant continues to search its current location
for each ant in the swarm
the ant searches a tiny of its location, at random
if the ant finds food
the ant becomes happy
if the ant doesn't find food
the ant becomes unhappy
If you run this algorithm you will find a "clusters" of ants form, which is a number of ants who share the same foraging location. Importantly, and this is mathematically proven, the largest cluster will form in the location with the best probability for finding food. This algorithm works even when the locations change over time and, as in the article, even when the ants which found the location are replaced with ants who have simply followed other ants to get there.The aspect which captured my attention is that there are tiny changes to individual lines of the algorithm which implement diverse behaviours such as hill climbing, optimise for exploitation or exploration, and global optimisation.
The algorithm is called Stochastic Diffusion Search and I'm in the process of polishing a Python library which implements it and its many variants for a Show HN :) The repo is here https://github.com/AndrewOwenMartin/sds some info and an explanatory animation here http://www.aomartin.co.uk/sds-animation/ and an beta version is already on PyPi here https://pypi.org/project/sds/.
Contact me (email address on my profile) if you're interested in using this algorithm or contributing to the library, it needs snappy C implementations, and a better explanatory animation!