I think I learned that in kindergarten.
Stop, look and listen is taught for roads. But most people don’t live near railroad tracks. And most of the time, railroad tracks are empty, so there isn’t that sense of danger a road presents. (Although near city tracks with commuter trains all the time, I would think people would be more careful).
But a lot of kids, often wearing headphones, would get hit walking on tracks near a nearby park in spite of the signs. They put up a lot of fencing and that has reduced the deaths.