You consider doing something (X). X is something you could do if you chose to, but not something do very often if at all. You would have to go out of your way to do it. You imagine what would happen after you do X. One of the results is something that would be dangerous or unpleasant (Y). You imagine that you would be scared or upset if Y happened. You can easily and reliably prevent this unpleasant thing Y from happening by not doing X. You don’t do X. You stop worrying about Y.
You remember what happened the last time you did something (A). You thought A was a harmless thing to do, and you did it almost without thinking, but then something else (B) happened because of it. B happened suddenly and unexpectedly, and it was very hurtful and/or scary, and you were terrified. Thinking about it now, you’re still terrified. What if you do A again by accident? And not only that, if something as harmless-seeming as A can make B happen, what if other things you do cause B to happen, too? You are constantly on alert to keep from doing A. You are constantly afraid of B.
Both of these things could be described as “learning from the consequences of your actions,” but they are not the same thing.