Negative consequences/feedback from their social group tend to do the job quite nicely, in most of the cases :-) To paraphrase the old comedian Will Rogers, there's always been three kinds of people in this world:
those who learn by reading
those who learn by observing others
but that third group just _has_ to go and pee on that electric fence.
We can't optimize society to coddle the fence-micturators 100% of the time, unfortunately. Solutions to that problem "don't scale", or get terribly fascist in a hurry.