How I learned Standard German in the 1970's
I was born in 1965 in Graz, the capital city of Styria (Steiermark, one of the nine states of the federal republic of Austria) (Wikipedia-Artikl iwa'd Steiermoak auf Steirisch, meina Muttasproch, owa leida fü z'kuaz), and grew up in a rural area in the north-east of Graz. My father is from Riegersburg, a small village next to Feldbach in the south-east corner of Styria, and my mother is from Weiz, a small town in the center of Eastern Styria (Oststeiermark).
When I grew up, everybody I had contact with (relatives and neighbors) spoke the local dialect, which is a Middle-Bavarian or Danube-Bavarian dialect that has no genitive case. Dative and accusative are merged together to one case (with a few exceptions). The vocabulary of this dialect overlaps with standard German to a big extent, but still there are many different words, and even the words that both languages have in common are declined and pronounced differently. So I would call Bavarian a distinct language, rather than a German dialect. Read more about this topic here.
In the late 1960's even the radio station favored by my parents broadcast a lot of dialect speech, but that was irrelevant because I did not listen much radio. TV started broadcasting at 5 pm, and we had no TV set before July 1969, when my dad bought one to watch the Americans going to the moon. And even when we had TV, I did not watch much TV, because there was not much content for kids. So, my contact to Standard German was very reduced.
I did not attend pre-school or kindergarten. I entered school at the age of 6 in September 1971, and nothing changed. All other kids spoke the same dialect as I did, and also the teachers did. But from time to time, when we learned reading, our teacher began to speak in a different manner. More like the strange people form TV and radio, which felt very strange to me. I later noticed, that this kind of speaking of people from TV and radio was called »Deutsch« and that the normal way of speaking used by "real people" (people I could smell, touch and see in color and 3D) was called »Mundart« or »Dialekt«.
So, for many years, we all still used the dialect to talk with relatives, neighbors and friends, and also with our teachers in other subjects than »Deutsch«. But in the German lessons, we had to use this strange kind of speaking and writing. Using the new genitive case caused a lot of trouble, and distinguishing between dative and accusative case is a skill many of my classmates never learned.
So, for myself I can say I learned Standard German like a foreign language in elementary school in the early 1970's, and I began to learn it when I was 6. I can't say when exactly I was fluent in Standard German, but that was definitely after the age of 10. And I know some people of about my age (50+) who live in the region where I grew up who still can't actively use Standard German for communication. They understand it very well, so they can use it passively, but when they try to speak or write in German, some of them just replace dialect vocabulary by Standard German terms but use a grammar, that is a wild mixture of Standard German grammar and Bavarian dialect grammar.
Today's situation is completely different
50 years later, today in the 21st century, the situation is completely different. TV and Radio are available even for toddlers, and they all broadcast Standard German only.
Austropop was a music genre that had its high time in the 1980's but had its beginnings even before 1970. This was contemporary pop music with dialect lyrics. In the 1980's a lot of #1 hits in the Austrian charts belonged to that genre. A few years ago (between 2015 and 2020 I guess) kids at an age between 14 and 18 where asked to listen to Austropop songs, and then they were asked to translate the dialect lyrics into Standard German, but almost all of them failed, because they did not understand the lyrics.
Within only one Generation the colloquial language that young people in Austria use, changed so dramatically, that the kids from today are unable to understand the language that their own parents used when they were in the same age.
When I hear kids talk together in the bus now, in 2022, I do not hear any dialect at all in Vienna, and I hear only rudimentary fragments of dialect in rural areas. The actual colloquial language of kids in Austria is that of young YouTube influencers from Germany who tell the kids how to apply make up and how to dress. These influencers are very cool in the perception of the kids, so the kids imitate them and so they also use their language as their own language. Dialect spoken by the generation of their parents and grand parents is outdated and uncool. Today's kids avoid speaking this way.
Today there are almost no more native speakers of Bavarian dialects among the people born after 2000. I believe, that this dialect will become extinct within this century.