People are complicated and it's difficult to find individual causes; and everyone responds to things differently. I'm not trying to say that everyone who commits crimes just has low self esteem. People have choices; and there are genetic and other environmental factors (exposure to lead being a big one). But it's quite certain that subconscious "I deserve to be punished" motives are a thing.
Most likely, stealing your wallet was part of impulsive behavior. Your was not first wallet and him being threatening or obnoxious was not his first such time. Most low level criminals are like that.
The name for this in statistics is ergodicity. Nassim Taleb, an expert on this subject, as well as many other authors in risk management have established that even professionals in statistics fare very poorly in understanding ergodicity in real life.
In short , its not psych, its human nature
Plus there's a weird psychological effect in some people where they feel guilty and actually want to get caught. A few years ago I dropped my wallet somewhere, and someone picked it up and used the contactless cards a couple times. They caught him when, the next day, he was shouting and threatening people and generally acting obnoxious, and was arrested with my wallet (complete with my photo ID) still on him.
Why did the guy suddenly get himself arrested? Why didn't he at least get rid of the wallet first? Maybe there's no connection between the two, but people are complicated.