Why would all countries not just use rails that can tolerate all possible temperatures.
In the US, the typical construction method is welded rail. AFAIK there is no allowance for expansion, at least on straight sections. Perhaps curved sections can move a bit to allow for expansion but move too much and the train goes off the tracks.