"We want to go along all of the Rhine and all of the Moselle."
That's not hard on the Rhine for the area between Bingen and Koblenz (the most scenic part.) Train tracks and roads cover both river banks. On the Mosel you will spend endless hours in the car if you attempt the whole thing. Better to bypass most of the numerous river bends west of Cochem if traveling by car. By train, Koblenz-Cochem follows the river. Koblenz-Cochem-Trier by train takes you to many nice towns on the way.
If wine figures in your plans and you're driving, that will require some serious scheduling (DUI blood level limits are low.) By train, you have complete freedom to do some tasting and traveling around at will. Wine tasting is typically done in town - not out in the vineyards - so don't feel the car will mean better access to tasting opportunities.
Boppard wine garden, in town, near station:
http://www.deutschlandgourmet.info/bilder/gross/5710-Restaurant-Weinhaus-Heilig-Grab-Boppard.jpg
Anyway... I would encourage you to be selective on the Mosel about your river destinations. Cochem is a good base town there.
I agree that St. Goar makes an excellent base town on the Rhine, especially for train travelers.
I suggest making Mainz a stopover upon leaving the area for Heidelberg or Stuttgart or Nuremberg or wherever you are headed next. 4-6 hours in Mainz is probably adequate. There's a lot to see, but you probably won't be interested in seeing everything. Mainz is not "quaint" for the most part, however.
Neither is Koblenz, which IMO ranks somewhat lower than Mainz as a destination.
https://www.tripadvisor.com/Attractions-g187393-Activities-Mainz_Rhineland_Palatinate.html