Because they have SUPER long range. They could be behind enemy lines and shell cities. They were mostly bombardment guns.
The railway guns were basically obsolete after WW1. They were the favorites of a few high military personnel, so they got produced, but saw little real action, were too vulnerable, were hunted down all the time, and had to hide a lot.
Basically, they were a threat, but not much of one.
The biggest guns in WW1 actually had barrels so long they whipped when the round went out. The shell was reported to have reached the outer edges of the atmosphere (stratosphere?? Something way up there) before coming down.
One shell from the largest gun hit Paris and they thought it was a gas explosion. It was only a week later when the second shell hit (1 week reload time!!!!!!!) that they realized they were being shelled.