The link is less about the violence itself and more about arousal and timing.
Intense, fast-paced play raises your heart rate and keeps the nervous system in an alert state. Sitting down to sleep immediately afterwards means your body is still in "fight or flight" mode, and that makes drifting off harder. Bright screens in a dark room add to the problem by suppressing melatonin, the hormone that signals it is time to sleep.
For younger children there is a second factor: frightening imagery can genuinely produce nightmares, and a long session late at night gives the mind little time to wind down. Research on violent games and sleep is still mixed, but the winding-down advice is uncontroversial — finish an hour before bed, dim the lights, and pick something calmer for the last round.