Exactly. It's like the people who are calling for drugs to be legalised - they think it only affects them. But in reality, it affects everyone, from those who can be assaulted by someone who doesn't realise what they're doing because they're under the influence, to the NHS, which has to pay to treat people who have fouled their bodies up through drug-taking.
In addition to deterring people from putting themselves & others in danger, Trespass on the railway could be used for people like vandals, for whom there's not enough evidence to charge them with anything else.