It looks to my casual research like the Union Pacific Overland Route and a Central Pacific Route were some of the earliest.
I'm primarily wondering: were these railroad construction projects meticulously planned? Did the railroad companies (presumably without any revenue as of yet) send out surveyors and engineers to plan the routes? I've had a longstanding impression that they used dynamite to blast through terrain that was in the way; is that so, and if so, were those blasts preplanned before construction began?
The railroads you mention were the ones who constructed the Transcontinental Railroad, opened 1869, decades after railroads came to the US.
Railroads were initially built as ways to get goods to market, either collecting produce from a productive agricultural region for shipment from an ocean or river port, or shortcutting a longer water or wagon road route. Carriage of manufactured goods the other way, and passengers, were important but secondary parts of the calculus. Later, linking together territories for political reasons became an important rationale.
19th century railroad projects couldn't be as meticulously planned as they can today. The first step was determining a general route, constrained by terrain, available mountain passes, water sources, and to some extent, political considerations. The US Army conducted the Pacific Railroad Surveys in the 1850s, and Congress in 1862 chose a general route. The railroad companies then employed surveyors to determine specific routings to conquer steep grades, avoid long lines of fill, and bridge rivers and creeks economically. A talented surveyor able to envision the various tradeoffs of different lines of road could save the railroad millions of dollars and months of work. Once the line of road had been determined, the on-the-ground work of filling, blasting, and grading was supervised by others working on short stretches. There was no set of complete construction drawings as we would have today.