I like the theory that many emotions, especially negative ones, exist to spur us to some type of action.
Anger means we need a way to resolve a conflict. Fear means we need to take steps to protect ourselves. Regret means we need some introspection to discover how we should do things differently in the future. Revulsion means we need to avoid something. (This applies in less abstract, more visceral ways too. Hunger means we need to eat. Physical pain means we are reaching our physical limits.)
Anyway, a lot of suffering comes about because we don't take any action. When the situation continues to exist, the negative emotion continues to exist.
This isn't to say we should just all act rashly to get rid of our negative feelings. Obviously the right action is important. But sometimes just getting started is enough to help feel better. And if you've already done what you could or should have, sometimes it helps to realize that or remind yourself of it.
This means that the suffering is not always aligned. This is very not obvious since our association of "feels bad == bad" and "feels good == good" is very strong since it's so obviously hardcoded. But it's not hardcoded for your benefit, it's there for building the pyramid, remember that.
A lot of it is quite obvious in the issue of short term vs long term gratification, but there are more complex interactions. People can drown in guilt when something bad was done to them, and a person may be very happy from a sexual encounter, unable to see the causal link between it and the alimony payments they'll soon be making. Reason is necessary, emotions are a blunt instrument. Intuition is better than raw emotions, but requires calibration. Emotion and intuition can be overwritten, to some extent, which is what most of this thread is about.
But quite often, the incentives do align, as we're one of the more advanced and successful species out there, which means we're less likely to be afflicted with the kinds of sufferings and pleasures that lead to a loss of power (i.e., musth in elephants).
There was no council of people who have decided that moving animals need to consume energy in the form of food, and that they would feel pain if they do not consume enough of this energy in time. Yet here it is, and every creature is enslaved by it.
Adult, well-read humans blessed with mental faculties are at times able to cheat the mental pathway and come up with ways to not have it show up at the forefront, but there's nothing self-inflicted about suffering, and assigning quasi-religious themes to this process is not doing us any favors.