Earlier quoted context omitted.
I think this is one of the most unfortunate memes that people for some reason still continue to share. Think about what it teaches children when they hear it? What kind of a world view does it instill? By saying the phrase you are explicitly communicating the idea that it is (at least is some sense) better to not do good deeds.
Search for “woman murdered while helping motorist”. There are too many evil people to willfully ignore the dangers of helping others. You should always, always be aware of the risks you’re putting yourself in any situation. In life, in work, in family, it doesn’t matter. And yes, that’s worth teaching children.
As long as the positives outweigh the dangers, it's worth doing.