burnt child dreads the fire
A person who has suffered from doing something has learned to avoid doing it again. — A proverb.
Once Mary had got lost when her mother took her downtown. But a burnt child dreads the fire, so now Mary stays close to her mother when they are downtown.