Or it made it necessary to regularly create new close and parallel rails in case of too important depth in formers. Note that it was also possible to fill in the bottom of rails with gravels, in flat and horizontal zones, to delay the wear.
In many cases, you have the feeling that a rails path was modified to connect to another one, in order to connect in a new pair of rails by abandoning a part of the former.
Optimized paths could have been defined considering slopes, distance and location of "point A" and "point B". Then, it was not a big deal to engrave a line of passage to be followed for the first transportations, so creating initial tracks to be followed afterwards. Of course, such a process would be impossible on the totally disturbed terrain we see today, but long, long ago, the soil must have been smooth and much less damaged by erosion (and catastrophes, think of boulders hurled on ground by giant waves).
I live in a limestone region, with numerous stones just below ground in my garden. When necessary, it's relatively easy to break them with a pickaxe, and to reshape some border stones with a small (but strong) hoe.
Hard stone neolithic tools could do the job on soft limestone (of course, not the same story on granitic stones).
You proposed a part of this explanation with your examples of real railways, Clapham Junction in London and old fashioned signal box. Clapham junction in Malta looks random at first sight and at human eyes height, but walking around the zone and checking on aerial views makes you realize that there was here a sort of deliberate planning to fulfill organization needs.
Elsewhere, I don't know.