The picture has a clinical name — agoraphobia — and is widely misunderstood. It is not fear of open spaces but fear of being somewhere from which leaving would be difficult or embarrassing if something went wrong: the underground, a checkout queue, the middle of a cinema row, a bridge, a motorway with no exits.
It usually begins after one or more panic attacks. Having experienced panic on a bus, the brain associates the bus with danger. Avoiding the bus lowers anxiety immediately, and the drop reinforces the avoidance. Next time, the list expands: the tram too, then the large supermarket, then any long walk.
The mechanism that expands the territory is avoidance itself. Every detour confirms the place was dangerous and that only avoiding it saved the situation. The person never learns that nothing would have happened, and the safe zone contracts month by month until only the house is left.
Then come the safety behaviours: only going out with someone, only with a water bottle, only on the known route, only with a pill in the pocket. They make going out possible and simultaneously prevent learning — because success gets attributed to them rather than to the danger not existing.