During high temperature periods, railroads, these days, enforce reduced speeds for trains, and send Track Inspectors out in a Hy-Rail, twice daily on busy main tracks, and sometimes ahead of each train (especially HAZ trains) on lesser-used tracks, if personnel are available. And, if you go down to your local heavy duty main track, you will see rail anchors clipped to the rail between ties, to keep rail from creeping.
In the past, when all track was jointed rail, there was also a section gang about every 10 or 15 miles, and they patrolled the track in very hot temperatures. The Section Foreman also knew his territory, and that included knowing where any track buckling was most likely to occur based on track condition and engineering. Jointed rail has the ability to absorb a small amount of linear expansion and contraction, more than welded rail.