Two things. An episode of overheating expands the engine beyond its normal limits, stretches the head bolts and releases the torque on them, allowing the gasket to fail. Many of these failures can be prevented by having the head bolts re-torqued anytime overheating occurs.
The second reason is not as rare as OK thinks. That is simply poor engine design. Great care must be taken to maintain head gasket integrity in todays aluminum engines. Different manufacturers use different techniques, some successful and some not.
Re-torquing the head(s) at 20,000 miles and again at 60,000 miles can't hurt anything and is cheap insurance. This job can be difficult and time consuming so it's seldom done in todays "if we can't do it in an hour, we don't do it at all" world of auto repair. Most mechanics cringe at the thought of removing a camshaft in order to re-torque a head..If they are going in that deep, they would rather take your $2K and replace the failed gasket...
In engines where head gasket failure simply can not be tolerated, the engine is designed so no head gasket is used. The head and cylinder(s) are cast as one piece. Aircraft and racing engines are often built this way..