In that era railroads were valued based on what the investors had put into the business in terms of bonds or stocks, not based on the net revenue stream they could generate. The equipment could and did depreciate, but the locations in the cities and towns and the inter connected right of ways, including the engineering at each river crossing, were permanent. A railroad could and did regularly rebuild as long as it owned the right of way. Under the accounting systems that existed at the time, the railroads seemed to be worth only about $1B.
In contrast the slaves were valued based on the prices generated at major slave auction centers like in New Orleans. They were valued at the theoretical sale price, even though as someone has commented, in the middle 8 states, many of the slaves were not for sale at any price.
The more accurate way of looking at it was that the railroads were capable of generating an infinite amount of revenue that was dependent not only on the strength of the cotton market, but on the total economic health of the US.
And as you noted, the direct routes were worth much more than the indirect routes. The direct routes were cheaper to maintain and required fewer engine miles, and in that era engine maintenance was a large expense.
Some of these places that did not seem very important based on the size of the town were very important for the efficiency of the railroad system. In the north it would have been places like Toledo, OH or Altoona, PA. In the southern areas, places like Atlanta, Chattanooga and Nashville, despite being very small towns, had critical switching yards, roundhouses and machine shops that were extremely valuable.
Once General Sherman's forces occupied Atlanta, and the US siege covered the Weldon RR which was the direct route south from Petersberg, the Confederacy had to control the Shenandoah Valley. Why? Because it was close to Richmond. And the Confederacy was running out of locomotives.