Well, IANA Linguist but I understand it’s true for Europe, at least in some cases:
Basque was pretty much unused in written form until the birth of the modern concept of Nation, in the XIX century. Previously, documents written in Basque were few, far between and intended for the writer himself (or his descendants): notes in the margins of a book (the same book which holds the first written words in Spanish), tombstones, pieces of family records. They weren’t written in order to be able to communicate with people far away: Latin, Spanish or French would be the languages used for this other purpose. And if someone who only spoke Basque needed to send a letter? He’d go to the local scribe, who’d write the message down after translating it to the current trade language and send it, either to its destination or to another scribe who’d translate to the recipient’s local dialect.
Basque “old” dialects can be mutually unintelligible, it is common for speakers of two different dialects to need to switch to Spanish, French or to the invented official dialect (Batua, “unified”).
During the Roman empire, written documents travelled all over their territory. There were dialectal variations, but any official document would be written in “standard Latin.” The Empire breaks down, and there’s a period during which people barely write, much less write to each other; middle class people who under the Empire would have been literate stop being so; in many places, writing becomes the despised task of people in skirts (monks and women). That period between the crumbling of the Western Roman Empire and the end of the “barbarian invasions” sees what had been dialects of Latin become the first forms of current Romance languages.
I’m simplifying; I know that for example in Spain people from the kingdoms of Leon and Aragon wrote about the Navarrese being “a bunch of barbarians who write in Romance language instead of Latin” during the first two centuries of the Reconquista or so; thing is, that means “Romance language” (proto-Spanish, in this case) already existed by then and was recognized as distinctly different from Latin. Many of the Romance languages which were born during that period diminished greatly or dissapeared as national boundaries got reestablished, laws started being issued in Romance languages and writing became widespread again (between Gutenberg and the first newspapers, “posh” people might stick to the dialect of the capital and spurn their “provincial” servants, land-leasers or colleagues, as reflected for example in many Spanish literary works of those centuries; the advent of newspapers spread that “poshness” around). That doesn’t mean people from Cádiz, Pamplona, Montevideo and Cartagena de Indias all speak the same, but they can find a common ground much more easily than if they weren’t used to reading the same books and magazines… and even more, nowadays: watching the same TV programs and movies (with the caveat that American movies and programs usually get double dubbing, for Latin America and for Spain).
If you are trying to communicate with someone and you’re conscious that there is dialectal variation between you, you choose the word that you think is more widespread. When both parts perform that act of courtesy, what happens is that the more-widespread word gets more and more usage, while the local variations shrink.