The D&D Alignment system is nonsense.
This isn’t some deep wizardry here. This is just a really rudimentary fact. The entire system is phrased like it’s a moral judgement framework and there’s been a truly enormous quantity of writing trying to thread the needle of explaining a moral framework that is both simple enough that a game system can handle it, while also making a way of representing actual human interactions that can’t be exploited by the most sophomoric seventh-grade part-time evil dictator.
The main lesson of the morality system of D&D is a greater one for designing rules in general, though: Rules are stupid, or rather, rules cannot make choices or judgements. Rules are things humans interact with, they are not capable of making complex judgements themselves. What you want a rule to do is interface quickly with a player asking it a question: Hey, what happens when I do this?
The rule should, ideally, serve as a sort of curve bend in a pipe – player intention runs towards it, and that pipe just directs the player’s intention in the right way, with as little friction as possible.
How does this apply to the Alignment system? Well, largely it means you have to start acknowledging it as a silly rule, and accept that it’s not really going to be a good tool to use to direct player intention. If you have a Paladin who tortures someone and whose player expects their moral standings to stay Lawful Good, your problem there isn’t in game rules, it’s that you’ve got someone in your group who thinks they can justify torturing people as a good thing.
What it means is that you need to approach the morality system as a set of flags: Spells that want to ‘blast evil people’ can be used for dramatic reveals, or things that impede ‘good characters’ from entering should be as simple as a boundary or barrier… but you shouldn’t be using them as a moral system, just as a way to put simplified flags on things.
Or, you know, just ask yourself if it’s worth it to have spells that want to try and make complex moral judgements on the fly?