There are two reasons anyone does anything, a good reason and the real reason; or, more precisely, a rationalisation and a subconscious motivation.
You can't stop unnecessary suffering unless you actually understand why you do things - i.e. what you really want, what your actual psychology and physiology needs but won't admit, and what prompted you to a course of action that led to suffering. The problem tends to be that if you don't get your subconscious needs met by your actions (and you almost certainly won't because the subconscious doesn't behave rationally), your subconscious will declare that the whole thing was a disaster and make you miserable. In contrast, if you admit to yourself what you were subconsciously trying to do, and that it was never going to work so no point beating yourself up over it, then you can actually rationally estimate the concrete advantages and the disadvantages of the action, and then try to turn the disadvantages to your advantage (even if the advantage is "now I know not to do that again").
In this way, you can minimise unnecessary suffering, to leave more time, space, energy and resources for necessary suffering. (Because, as the Buddha correctly said, life in this world is suffering, you might as well pick the most effective and useful form of suffering.) And part of that wisdom is learning that real fulfilment means acting in accordance with your own inner nature, and can't be found in any possession or symbolic capital. Aleister Crowley said "Do what thou wilt shall be the whole of the Law"; Karl Marx said that the essential nature of humanity was in labour (i.e. productive, creative work) rather than consumption.