I read that somewhere
You know, I’ve read that stabbing them through their head doesn’t really kill them because they have distributed ganglia instead of one centralized brain.

You need to define what the word alive means first.

If you cut a roach’s head, it stays sort of alive in that the body responds when trying to touch it or expose it to harm but it won’t do anything if left alone. just standing still until eventual death.

A decapitated roach might still be able to “feel” pain but in my personal opinion - I am no expert in the matter - it doesn’t feel stress, trauma or have bad memory of the incident. Just pain and an appropriate reflex to it.

In this context “alive” means “still able to feel and process pain.”
How does the decapitated roach feel the pain? The processing unit has been disconnected from the source of pain.

No it hasn’t been. Cockroaches, lobsters, and other arthropods have a decentralized nervous system. They have ganglia throughout their entire body instead of one centralized brain. These ganglia can react to stimuli independent of the other ones.

scientificamerican.com/…/fact-or-fiction-cockroac…

Fact or Fiction?: A Cockroach Can Live without Its Head

A nuclear war may not trouble them, but does decapitation?

Scientific American
Yes, “decentralised”, “can react to”, but what about perceiving? That’s what modern mortality cares about. Most plants react to stabbing but since there isn’t any processing unit of such signals, we humans don’t take moral punishment from doing so. We don’t emphasize non-sensual creatures.
Honestly they may not be able to perceive in any way we would recognize. Arthropods are about as distant as you can get from humans while still being in the animal kingdom, were in Maine and they’re in American Samoa. So while they most certainly perceive the question of sentience in the more traditional sense is up for debate, though there is at least one species of spider that has a proto-brain so it isn’t universal.