Problem with railways is that track is a separate entity from freight, which is separate from traction, and passenger is also separated into local commuter and long distance. Thus you have 5 divisions in any region, and they all are want to run the bare minimum of service quality. Track is worst off, it has an entire network to maintain, off the charges it levies on the other entities, so it is very loath to actually spend money till there is a derailment, as the staff in it are not really enough to actually maintain the lines properly, let alone build out new. Accountants cut the staff to the bone to make a profit, and the unions do not allow any cut in benefits, so staff costs are expensive, take a lot of training and in service training, and work very regulated hours.
Track maintenance is one of two things, lots of cheapish labour, spades, rail irons, pickaxes, large hammers and a few rail cars. Or an automated massively expensive machine, with a dozen or more skilled operators, running along slowly, with at least 10 rail cars bringing in precast sleepers, lengths of rail that will be automatically welded into position, relaid, retamped and then the maintenance vehicle travels over the new track section to the next. first one is easy to implement, but takes a shed load of time to work on a length, second is faster, can run around 20km per day for simple maintenance, but you need to run it 24/7/365 to warrant the near billion dollar outlay for the complete arrangement and the staff training and pay. Something like a 3 year apprentice program just for the practical side for the both of them, though the grunt labour does not need much training, other than tell to follow the others, and use the shovel like the guy next to you does, or get clobbered over the head by him when you slack off.