score:8
Because they were settled by Germans who kept in contact with other Germanic regions.
Upper Valais speaks a German dialect because it was extensively settled by Germanic immigrants during the Middle Ages. At the time, Switzerland in general was being gradually infiltrated by Germans. Upper Valais, specifically, was settled by German speaking colonists from Bern.
The permanent settlement in part of Switzerland and in Alsace of German-speaking people from Swabia can be traced back to the fifth century AD. Some of the Alemanni tribe are thought to have arrived in the very first centuries AD. They were already used to living in the high country of south-west Germany. In the eighth and ninth centuries, they spread into the upper regions of the Aar basin, the high midlands of Switzerland about Bern, and later from there over the mountains into upper Valais canton ... in the tenth century.
- Lamb, H. H. Weather, Climate and Human Affairs: A Book of Essays and Other Papers. Routledge, 2013.
Bern was linked to Valais via mountain passess. Though the question considers it "difficult to come across before railways", in fact the LΓΆtschenpass was a major regional trade route. Regardless of its real or supposed difficulty, the path was evidently a viable link between Bern and Upper Valais.
The LΓΆtschenpass has been used as a trading route between the Valais and canton Bern since at least medieval times.
- Reynolds, Kev. Walking in the Valais. Milnthorpe: Cicerone, 2003.
Until the trade route declined (perhaps due to climate changes), the German inhabitants of Upper Valais kept in touch with their homeland through this route. Whatever caused the trade links to drop off, by then Germanic communities from Upper Valais were already subjugating the French Lower Valais.
The Wallis/Valais canton was settled by German immigrants who maintained contact with their mother region over the mountain passes until they became inaccessible.
- Parish, Romola. Mountain Environments. Harlow, England: Prentice Hall, 2002.
At this point it doesn't make too much sense for the Germans to switch over to French.