The day we qualified as (primary) teachers, final day we ever went in to uni, they had union reps come in and one of them said "Never hug a child to comfort them even if they're hurt or upset because it could be misconstrued." and went on to say essentially, as a teacher you have to think of yourself and your career, first. This was many years ago, long before Yew Tree etc and when the culture was very different. But even then - first advice we were ever given, literally the moment we qualified was: "Protect yourself."
Not sure I'd leave a stranger's 2 year old to walk down a road alone, but on the other hand, I can also see why people might hesitate to intervene, assuming there's a parent about to hove into sight round a corner, or worried that they'd be accused of abducting him if they tried to return him.
Can't tell you the number of times we were cycling on the Sustrans track and some toddler or 4 or 5 year old was walking along unaccompanied, despite bikes going past at speed, loose dogs, small bodies of water as it's managed as a wildlife area, etc - whilst some parent followed a long way behind (even out of sight) intent on their phones, totally ignoring the child. I also live on a national speed limit road and we'd often see our ex neighbour, the dodgy one, "walking" their kid to the school bus stop, tapping away on her phone and not even holding her kids' hands or looking at where they were. No pavement so the children were walking right on the road and the traffic going past at full speed because they think it's the middle of nowhere. And again, the parent utterly disengaged and intent on their phone. We saw this daily for several years til the school cottoned on they were alcoholics in charge of young kids and laid on a taxi to pick them up from their front garden. There was no intervening as a person who saw this and if anyone had walked past and tried, they'd have been verbally or even physically assaulted, no doubt.
In recent years it's become more common to see a child wandering along alone whilst the parent is some distance behind, so depending on the terrain (if there's blind bends for example) people seeing the child might not intervene as they'd assume 50 metres away, just round the corner, is a parent playing Candy Crush or texting a friend.