Treat this myth with due scepticism. Snakes have the opportunity to literally cook themselves to death in the wild, but obviously they don't have a propensity to do so. It's a common story but in reality we almost never see this issue. Snakes are ectotherms which are expert thermoregulators. Dealing with temperature in the best possible way is one of their greatest talents.
The only issue is when the cage is cold, forcing the snake to seek heat, and the heat source has a very (*very*) small intensely hot spot. A snake won't just burn itself by sitting on a large object which is going to overheat its whole body. If there's an intensely hot, very small heat source, sometimes they will attempt to heat up by using it. Imagine being freezing cold on a cold day and trying to heat your body using a candle flame. Some people might be desperate enough to burn themselves. But you would only be desperate enough to try that if it was extremely cold and you had no other option. Same with snakes, you need to have an extremely bad setup to give even a remote chance of convincing a snake to burn itself. If a snake is sitting on a large, even heat source when it has other options, it is doing so because it wants to. All Australian snakes, even those in the coldest parts of Australia, in the wild have the opportunity to heat their bodies to temperatures which would kill them. Almost literally all, including literally all of the ones in the coldest parts of Australia, have the option to heat their bodies to over 70 degrees celcius, enough to seriously burn human skin. The only exceptions are in places such as the wet, dense tropical forests in north QLD. Even in Tasmania you'll find places where rocks get above 80 degrees. The snakes can avoid them.
Diamonds live in a climate where they spend most of their lives fighting for every bit of warmth they can get, and they'll actively take advantage of hot basking spots, unlike tropical Carpets which naturally don't need to bother working for their heat, and are much more nocturnal.