Yep, you aren't the only one with this problem 😂
What I do to prevent this is to use breeches with a "cooler" material. I know some brands which sell theses breeches in Spain (Spain is a really warm country... today it was 40ºC at the stables!!) These brands are Lexhis and Fouganza. But maybe you can ask about this kind of breeches at your tack shop! With this breeches maybe you still sweat... but not as much as you did.
The idea of wearing cotton underwear that Dani suggested can be a good idea too! 😊
Hope it helps!