The only solution unfortunately is to do some more research & read reviews which cover throttling & thermal management before you buy your next laptop to make sure you're not buying something that is defective. On my previous Dell XPS laptop the CPU and GPU shared one heatpipe & heatsink. It could handle 100% CPU with an external monitor, but the GPU was much more power hungry and placing any significant load on the GPU made the CPU throttle significantly. Each manufacturer & product has different thermal management solutions and you need to do research before buying to see if a laptop will work for you. You'll also want to see whether external displays are always driven by the discrete GPU instead of the integrated GPU on the CPU - even if not being heavily used, just turning on the discrete GPU creates a fair bit of heat.
Or just buy a gaming laptop if you can accept with the added size & heft - they're often cheaper for equivalent CPU/GPU than the 'premium' laptops like MacBook, XPS, but sometimes don't get the newest features (Thunderbolt, USB-C charging, etc.) as early. One of my friends had a gaming laptop with the same specs as my XPS and when under load his laptop would blow out enormous amounts of hot air from its big vents, whereas the XPS clearly had a much lower heat removal capacity.