self-punishment

Noun
  1. punishment inflicted on yourself
self-punishment
A student engages in self-punishment by skipping a fun outing to study.