Distinct dialects survive far longer in valleys, islands and remote uplands than on open plains. The mechanism is contact frequency, and it operates in a way that is easy to observe.
Language change spreads through routine contact
Speech converges between people who talk to each other often. A feature that is common in one community spreads to a neighbouring one through daily interaction.
Where terrain makes that interaction occasional, the two communities drift apart in small ways that accumulate across generations.
Valleys separated by high ground are the clearest case: the settlements may be close in distance and far apart in contact.
Valleys channel movement along their length
Travel within a valley is easy and travel across the ridge is not, so people historically married, traded and worked along the valley rather than over it.
The resulting speech community follows the valley's shape, which is why dialect boundaries in mountain regions correspond closely to watersheds.
The same effect appears with rivers, coastlines and marshland, wherever geography makes some routes far cheaper than others.
Prestige varieties spread along transport routes
Standard languages spread outward from administrative and commercial centres, following roads, rivers and later railways.
Places on those routes adopted features early; places off them adopted them late or partially, which produces a gradient rather than a clean line.
This is why the strongest local speech in a region is often found not at the greatest distance from the city but at the greatest distance from the route.
Schooling and broadcasting changed the rate, not the pattern
Universal education and national media exposed every community to a standard variety, accelerating convergence substantially over the past century.
The effect was uneven, and many speakers became bilingual in dialect and standard rather than abandoning one for the other.
That switching by situation is now the common pattern, with dialect used at home and locally and the standard used outside.
What travellers encounter is usually the switch
A visitor is addressed in the standard variety almost everywhere, because that is the register used with outsiders. The local variety is audible between residents.
Hearing it in a market, a bar or on a bus is therefore not exclusion but the ordinary working of a two-register community.
Learning a few local words rather than only standard ones is received well precisely because it signals attention to the distinction.