It would take around 8 hours in total to get from Munich to Hallstatt, and I would want to stop in Salzburg for 4 hours. Is this doable for a 20 something solo traveler?
It is doable but from my on experience it sucks being on the train all that time to get to one place and back.
I would not do this as a day trip. I would maybe stay in Salzburg 2 nights and do the daytrip to Hallstatt from there.
There are a lot of small picturesque towns. Hallstadt is cute, but hardly worth the huge effort to get there from Munich
If you left on the first train in the morning (6:24) and got back to Munich on the last train of the night (57 min after midnight) you would have four hours in Hallstatt (14:47 to 18:48). Doable, but why bother, unless you just want to add a name to a list of places you've "been to".
Possible, yes. Worthwhile, no.
It's not worth it as a day trip. Too much time on train, too little time there. Why don't you stay overnight?