Berlin is an extraordinarily museum-rich city. The time needed there will depend a lot on how interested you are in those art and ethnographic museums and the Cold-War/WW2 sites. Read the Berlin section of a guidebook or two, look at Rick's suggestions, maybe check out TripAdvisor's things to do. Be aware that the Museuminseln museums are really, really large. If you are interested in the subject matter of one of those museums (and if you're not, why go?), you will probably be there for many hours. Some of the Cold War sites are rather time-consuming as well. I spent six days in Berlin, spent virtually all of my time in museums, and still missed some that I wanted to see. Your experience may be totally different, depending on your interests.
One other thing: Berlin was overrun with tourists last August, which had an effect on how quickly one could move through some of the tourist sites, plus there were significant lines to enter the Museuminseln museums. I don't know how much better it will be in September; the city is justifiably a very popular tourist destination. If you spend a lot of time in the huge museums, it will be hard to make the city card pay off. If you're more a hit-and-run sort of tourist, it might save you some money.
Berlin was pretty much obliterated during WW2, and the city itself is not very rich in historic buildings. (This is not to say that it's unattractive, just not as interesting from that standpoint as some of the provincial cities.) If you are attracted to places of architectural interest, I can recommend Gorlitz (on the Polish border, so off your planned path), Quedlinburg (WSW of Berlin, not exactly on the way to Bavaria), and Erfurt (beyond Leipzig and a good stopover on the way to Bavaria). All three of those cities have stunning old towns with half-timbered buildings. Gorlitz is so picturesque that it is used as a movie location; it also has some art nouveau buildings. Quedlinburg has an incredible cathedral treasury (Google for the American connection) in addition to its beautiful buldings. Erfurt is a lively university town with Weimar and the nearby Buchenwald concentration camp an easy day-trip away.
Dresden (on the way to Bavaria) was fire-bombed during the war, and just a small area in the core was reconstructed, but it has some fine museums very much worth visiting if you're not museumed-out by the time you leave Berlin. The Historic Green Vault may well be the richest treasure trove in the world. Highly recommended if you want to see beautiful objects. A timed ticket is required, but I was able to walk right in last summer; my guess is that it's usually possible to visit the same day you inquire. One of the neighboring museums has a lot of armor on display if that's more your thing.
You'll probably have time to do a bit of non-site-specific wandering around Berlin before the marathon, right? If so, I think you do have the option of spending a few days in Munich or some other part of Bavaria, possibly with a stop along the way, if you want to do so. I'm a flexible traveler and do not lock down reservations ahead of time. If you're willing to travel that way, you can wait till you've spent a few days in Berlin and decide how anxious you are to move on to "cute Germany". Train service is generally good.
Have you priced out the round-trip flight to Berlin vs. a Berlin/Munich open-jaw?