A hurt human being will exert violence because it is the last act of agency available to them.
Or rather, because they believe it is the last act of agency available to them.
If you think these two statements are distinct, don't. They blur into each other. Do not underestimate the power of belief. It is infinite. When it comes to human action, belief is the only thing that drives. Belief is a prime mover. Everything else - muscles, words, code, money - is just a tool.
An exertion of violence is an attempt to re-assert your own existence.
The observation that my neurons can fire to extend my arm at such a velocity and in such a direction to strike someone's nose with sufficient impact such that it breaks their skin and blood vessels to make them stop insulting me is an affirmation that I can still exact my will upon the world.
(We can understand why evolution would have favoured the urge to continually affirm such a fact).
(I do not condone violence. It causes suffering to self and others, and is an ineffective long-run strategy. But it is understandable).
Trolling is small violence. It is a rebuff of a system that makes you feel small and inconsequential, or requires you to be inauthentic in order to win on its terms.
It takes initiative to troll, beyond simple ignorance or lack of engagement. Effective trolling requires a valid understanding of how the system doles out rewards, and what positive behaviour looks like within it, in order to actively construct something that is to the contrary. That constructed thing must be deployed with correct timing and context to make it clear that one sees the grain, understands it full well, and is moving against it anyway.
Moving against the grain hurts. Trolling is a selfish act, but it is also self-destructive. Its aim is to cause discomfort and inconvenience to the system's high-status players. Trolling is the deliberate misdirection of cognitive ability into a system, with blatant disregard for one's own status within it. Trolling is knowingly wasting energy. It is social suicide in the eyes of those who engage with the system seriously and at face value.
It is, however, a very effective strategy for winning another type of status game - which is garnering the sympathy and admiration of others who are similarly disenchanted. You can see now how trolls almost can't be faulted for doing what they do. Powerless (at least in self-perception) to excel within the officially sanctioned rules of the system, trolling is a rational course of action if it seems to be at all a viable alternative to remaining helpless, low-status, and unremarkable.
The upshot? A person who trolls has not given up. On the contrary, they are very much interested in asserting their agency. Trolling requires productivity and engagement. Trolling is always a second-best solution to actually winning the officially sanctioned game, and the more skilled a troll is, they more likely they are to be aware of exactly how the game is meant to be played.
If they at all thought there was a viable path to constructive participation, they would be doing that instead.