In places where Bavarian is widely spoken, at what age do children learn Standard German? Are they expected to speak Standard German by the time they go to school, or do they learn it there?
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.
Disclaimer: I'm from the only part of Austria where we don't speak a Bavarian dialect but an Alemannic dialect. It is the same everywhere where strong dialects are spoken, though.
In most areas of Austria highlighted on your map, speaking dialect is the norm in everyday life. However, in addition to the local dialect, children start to pick up Standard German from TV, radio, or books they are read to.
The degree to which children can actively speak Standard German varies, but starting from kindergarten, they learn songs or rhymes in Standard German. Clearly, in primary school, children learn to read and write Standard German. In Switzerland, as another example featuring notoriously strong dialects, kindergartens sometimes have teachers speak Standard German (except maybe when speaking one-on-one). From secondary school forward, if not earlier, the classroom language is Standard German, and students are expected to speak in Standard German during class. Teachers will encourage students and might correct them. The degree to which this is obeyed varies in my experience. A biology teacher might care less than a German or Latin teacher.
Note also that many people cannot actually speak proper Standard German. These people tend to be from rural areas or have attended school for a shorter period of time. When talking to someone who doesn't understand their dialect, they'll try to defuse it by replacing some words with equivalents from the standard language.
I live in Bavaria myself, in Munich, and I'm gonna be honest with you: I can't speak Bavarian at all and I don't know any people at all that speak Bavarian. However most people that speak Bavarian know Standard German by default and they don't really have to learn it. The number of Bavarian speakers is going down more and more anyways, so most people who can speak Bavarian only do it if they actually want to. And so to answer your question: Yes, they are expected to speak normal German by default (unless they are in a special school but I don't know if these kind of schools exist).
Adding an additional viewpoint to highlight the high variety of this subject.
I'm from Salzburg, Austria and grew up in the nineties (born 1988). I never actively learned standard german, it just came naturally to me like the local dialect and as far as I'm aware it also was like this for most of the people from my region and in my age group. To me, the distinction always was spoken vs written german. Virtually everyone spoke in dialect but wrote in standard german and books were also all in standard German of course. So my first contact with standard German was when my mother read books to me which started at a time I can't even remember (when I was like 1-2 years old), hence I more or less learned both at the same time with the distinction that standard german is for reading/writing and dialect is for speaking. In school it was the same, as well as in every workplace I worked so far. This distinction took such deep roots in my mind, that to this day it's really weird to me if someone talks in standard german (outside of radio/tv) or writes in dialect (which was a really weird trend among my age group for some time).
A similar situation exists in the Czech Republic, where the "generic Czech" spoken in Bohemia (the western part of the country) differs somewhat from the official standard, especially in the declination. My 9yo girl still cannot speak or write the official standard correctly. Frankly, I myself can produce the correct Czech, but I am not quite fluent at it. I have to focus a lot and when I stop focusing, I immediately slide back.