That’s one way to look at it.
Sometimes it might indeed resemble a punishment but please remember the many times when common sense prevented us from making huge mistakes that might have ruined our lives.