Something like that. The Japanese have raised internal guides in places, to cope with what might happen in an earthquake situation. If you derail on a bridge or on a high, steep bank, then it would be nice to stay close to the line, rather than fall off. Modern bridges are intended to keep the train on, but older ones may not be designed to do so.
If you can stay close to the track-line, then the possibility for damage and injury is lessened - usually.
Keeping things close to the line can also help to avoid pulling down loads of overhead structures.
http://www.rtri.or.jp/eng/rd/seika/2009/01/safety_E03.html
It's nice to keep stuff in line - this reduces jack-knifing and the loads on the occupants.