We map what is there, not what should be there. You should tag the legal access as additional information, though.
So, for https://en.wikipedia.org/wiki/File:Desire_line.jpg I would go for
* `highway=path`
* `surface=ground`
* `smoothness=bad` (just a guess from the image)
* `width=0.4` (if I would have measured/guessed it from reality)
* if needed: [access](https://wiki.openstreetmap.org/wiki/Key:access) tags depending on the legal situation and signage. If a sign forbids use officially (whyever it is there) but no one (including the owner) cares, then I possibly would tag it `access=permissive` + `access:legal=private` (or something). something similar … I am not sure if we have an established tag here) + `access:description=officially forbidden by a sign which no one including the owner cares about` (a tag describing the access to make it clear to users and mappers). Similarly, if a sign forbids use by all vehicles, but quite clearly only motor vehicles are meant (just the wrong sign was put up). up) I would not use `vehicle=no`. Note the [suggested default access assumptions](https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access-Restrictions).
Somewhat questionable is a "desire path" which crosses a railway line. Is there a path for the 5 metres across the railway line? Likely you cannot see it, you can just assume some use, but there is no real-world feature. In this special case (also influenced by the danger) I would tend to not map the part which is across the railway line.