Old rails are removed due to defect or they are no longer safe.
Track laying machines or ballast trains are railway related work, not passenger carrying trains.
So old rails are used where safety is not an issue. Looplines or PF lines too, the trains wont meet any mishap with old rails as they are slowly moving.