In the last few years, I have spent 4 days on the Rhein (Boppard) and 3 days on the Mosel (Treis-Karden). From Boppard it was easy to get to Bacharach/St. Goar, Braubach (Marksburg), and Koblenz (Burg Eltz was closed for the season). While in T-K, I visited Bernkastel-Kues, Zell, Cochem, and Beilstein. Moselkern (Burg Eltz) is easily accessible from Cochem. On weekends, there are buses from Treis-Karden to Burg Eltz.
For the Rhein, I would not recommend Bacharach. If you stay in St. Goar, you can take the train to Bacharach for 3,70€/person, then come back on the K-D boat. If you show your rail ticket when you purchase the boat ticket in Bacharach you should get a 20% discount of the 12,60€ price of a one-way, 1 person ticket to St. Goar. The rest of the time, for travel down (Northwesterly) the Rhein, you can use VRM (transit district Rhein-Mosel) tickets. A one day pass (Tageskarte) for all of the VRM is 18,50€ for one person, 21,80€ for up to 5 people. Passes for three days are 37€ and 43,60€ respectively. Tageskarten for less than the entire district are available for less. (In most, if not all cases, a Tageskarte is less than a round trip ticket) The VRM Tageskarte is valid on the Rhein from Oberwesel to Remagen/Unkel, and up the Mosel to Bullay (but not to Trier), and it is not valid to Bacharach (which is in the RNN district), which is why I don't recommend staying in Bacharach.
For travel including Bacharach and Trier, use the Rheinland-Pfalz Länder Ticket (24€ plus 4€ extra for persons 2-5 for each day).