I would buy a Westbahn train ticket from Vienna to Salzburg and then do a Bayern ticket from Salzburg to Munich. You could also do a Westbahn ticket from Salzburg to Munich. These are all fully flexible, with a few conditions.
But the bottom line is that if you have purchased a ticket for a specific time/train from Vienna to Munich, then you cannot get off and get back on another train. If, however, you have purchased a full fare ticket (hopefully not as it is way too much money), they that ticket does offer flexibility.
A rail pass is always overkill.