The region is well served by train. Unless you want a car for more extensive exploring, you can get around easily by train.
Bacharach is central-ish to the middle Rhine, and Cochem is central to the Mosel; two different rivers that intersect at Koblenz, which is also where you change trains from one area to the other. Staying in either Bacharach or Cochem and wanting to visit the other river will require 40-60 minutes of train ride.
Don't forget Marksburg castle along the Rhine. Marks burg and Burg Elz are RS' favorites, and having visited both, they are a great combination and study in different styles. I preferred Marksburg, in part bc the tour allowed you to walk around more where Burg Elz' tour was more like visiting a protected museum.
Maybe stay in Cochem two nights and Bacharach for one. I think Bacharach is a more straightforward departure for Munich, BUT not sure, so once you've looked at train routes and times, you can asses which town is the better departure for Munich and stay there your last night.
I would train to Munich, but again, different travelers prefer different things