Isolating their potential future terrorists from being exposed to any opposing views is step one in the process.
They must only be allowed to hear that their future targets are out to eradicate them, and that therefore they -the potential future terrorist- will be morally justified in killing the target. They do not commit these acts believing they are in the wrong; they commit these acts believing they are heroes, just as Islamic (and other) terrorists do.
These ideas cannot withstand challenge, and so anyone challenging them must be removed from the environment, be it reddit or college campuses or wherever. The potential future terrorist must be nurtured in an environment where ~everyone agrees that the future targets are an existential threat and therefore that it is morally good to kill them. If everyone around them is saying it too then it must be right, and especially at an age where people are desperate to fit in with their peers.
We cannot outlaw those ideas, but we can absolutely make it much harder for those ideas to exist and propagate unchallenged within those echo chambers (and really they are not just echo chambers but amplification chambers). Force online platforms over a certain size to decide between whether they want to retain the right to curate legal speech but lose the liability immunity they have been gifted, or to forfeit the right to curate legal speech (ie. to ban opposing views) but keep the immunity. The intent of the immunity was not to provide cover so that those platforms could be turned into terrorist production lines, and it is not a gift which has to continue to be given without conditions.