Your question seems to imply that not building the transcontinental railroad would have been ludicrous — but that’s only because we live in a world where it happened. There are plenty of nations whose borders end not at the opposite ocean, but where a neighbor’s nations begin.
I think you’re presenting a false dichotomy; the construction of the railroads was not about people eking out a living, it made a handful of people incredibly wealthy. I’m not informed enough about the era to say what the alternative would have been, or even to re-litigate history — I’m saying that we should approach our current dilemmas with a different math than that which has been applied in the past. I’m saying maybe there shouldn’t be a profit motive to incarcerate people, and we shouldn’t be running oil pipelines across Indian land (or any land, honestly) and the debate about gun regulations shouldn’t be between the survivors of mass shootings and an organization whose board members mostly profit from selling firearms.