The amount of salt in sweat varies tremendously from person to person and the amount of salt in sweat increases the more you sweat as your body dumps salt in an effort to keep the concentration of sodium in your blood constant (if that gets outside of a pretty narrow range you get serious health problems).
In very hot weather a medium-sized male could sweat at least three pints (1.5L) per hour. A pint (0.5L) of sweat might contain a half-teaspoon (2.5g) of salt. Do the calculations and you see that you might need to consume an entire tablespoon (15g) of salt to replace what you sweat out on a hot, humid two-hour ride.
There’s a problem, however: The salt that comes out with sweat is drawn from all the intercellular spaces in your body. When you put salt in your stomach, it moves into your intestines and gets absorbed into your blood, but then it can take a while to get back into all the spaces where it belongs in the correct concentrations.
Eat a bunch of salt and you pee a bunch of salt, minus a bit that can find its way back into the tissues. Drink a bunch of water, and you pee a bunch of water minus the little bit that reenters your tissues with the correct amount of salt, even if you are dehydrated. That means it can take a long time to rehydrate if you get significantly dehydrated. Thus you want to stay hydrated as you go as much as possible, rather than replenishing after a ride.
In order to replenish salt and water as you go, you’d have to drink water as salty as sweat, which would not taste particularly good, so eating salt tablets or salty food is essential on long, hot rides. The source of salt matters very little so long as you like it enough to get enough salt and you get enough water to roughly maintain weight on the ride (don’t drink enough to gain weight on a ride. That brings it’s own deadly problems).
If you had a power meter though, you’d also notice that your power is greatly reduced when training on those hot, sweaty days, so if you are doing these rides for the fitness value, do them in the early morning when it’s a little cooler, use an ice vest (or at least a frozen hydration pack) to keep you cooler, and pour water on your hair, clothing and skin to keep you cooler so you can produce power appropriate to the effort you make and get some fitness for your effort. You are sweating because your body is – or is trying to avoid becoming – too hot for optimal function.