Where (if any) can we go by train and avoid some of the crowds and heat??
You then later suggest Barcelona. If you want to avoid crowds and heat then Barcelona is not somewhere to go in the summer.
Barcelona is crowded all year round, I've been in February and everywhere was busy. Personally I'm not a fan of Barcelona, there are a number of places I'd visit over it but everyone's different. You've had several recommendations for Strasbourg, which is a logical stop in the vicinity but again, it will be very crowded. We were there in October and could barely move in the main square there were so many people there.
If you want to avoid crowds then you'll have to look at the less obvious choices. The popular places to visit are popular for a reason, that's why they're full of tourists so you need to decide whether you want to see the popular sights and accept that there are going to be crowds or tour the surrounding, less interesting, areas.