Laying down sleepers and rails is relatively easy. The difficult, time consuming part is setting out the alignment and prepping the road bed (and that's for conventional rail, not including exotics like electromagnetics, overhead wires, etc.). It involves moving around a lot of material, mostly fill but some cut as well.
Rail lines aren't entirely limited to benefiting trains. The right of way can be useful for vehicles and infantry especially in rough terrain. Trenches and berms can provide good cover for infantry. Speaking of which, high rail vehicles can be useful for moving small numbers of infantry around, drawing less attention than a full train. And now I want to design a light APC like that...