2 nights... that sounds like 1.5 days to do things. A lot of train trips from A'dam in August have 4-5 connections to make in order to reach the Rhine towns south of Koblenz (where you should stay for cruising, castles, etc.) The best journey I see has just one change of train at Cologne Messe Deutz - 8:08 - 12:55 for the journey to St. Goar, probably the most convenient town for getting around on both Rhine riverbanks. Suggest you stay there.
CRUISE: Bingen > St. Goar hits the most beautiful part of the river. The train I just mentioned, if you stay on it past St. Goar, will drop you at the Bingen Rhein Stadt station, a 5-min walk from the KD boat dock, at 13:39; there a cruise boat to St. Goar departs at 14:30 and reaches St. Goar at about 16:00. This is probably the slickest way for you to fit in the cruise. The following day, you have options... Rheinfels Castle tour, right in St. Goar? Or visit Marksburg Castle, the best medieval castle tour on the Rhine; just use the St. Goar ferry crossing to cross the Rhine and ride the local train to Braubach. St. Goar is only 10 train minutes from Bacharach, which is worth an hour or two just walking through the town to see the nice half-timbered buildings. In between St. Goar and Bacharach is Oberwesel. Take a walk along the old-town-wall fortifications there.
In St. Goar, look into the Hotel Rheinfels and the Rheinhotel St. Goar. They are just steps from the KD boat dock and have riverfront views - fantastic riverfront views. And it's an easy walk to the train station there as well.