punish (someone or oneself) for (something)
To penalize or discipline someone or oneself for some crime, wrong, mistake, or other transgression. Bob punished himself for breaking his diet over the holidays by only eating vegetables for two weeks straight. I feel like this heavy workload is the boss's way of punishing me for disagreeing with him during the meeting.
punish someone for something
to discipline someone for [doing] something. Someone will punish you for what you did. Please don't punish me for doing it. I'm sorry.