In most instances, the tracks were there before the people moved in.
Yeah, lots of little towns popped up along the track in response to it.
There is no railroad here anymore but my house sits on the spot where the local icehouse was. My yard is underlaid with bricks they used to slide blocks of ice off the lake into the icehouse and the track was right behind so the ice could be slid into train cars. There was a mill at the dam about 75 yards away, farms and logging all around.