(Psychological / emotional perspective)
When there is conflict in our lives, if we cannot resolve it we will often dream of being punished.
This may be the only way out of our particular dilemma. We would rather suffer pain than resolve the difficulty.
Inflicting punishment suggests that we feel some aspect of our personality is out of alignment.