Misbehavior carries its own consequence
In Sophie's episodes, each act of disobedience or greed produces a direct, often physical, unpleasant consequence (the eaten fruit makes her sick, the hidden crime is exposed, the cruelty rebounds). The narrative asserts that misbehavior is not punished arbitrarily by adults but carries its own built-in result that teaches the lesson.