I was there once, I was a three-year-old. You can well be aware that you will be punished for something like this—but then not have the willpower at that age to resist the obvious, delectable sweet.
(Yes, fortunately I wasn’t beaten to death over it.)
Still there is such a thing as going over the top.
So sorry for your childhood! So glad you overcame!