Do you think it would be morally justified to alter someone’s mind in these scenarios?

Controlling their actions isn’t “violating their free will.” To use a less emotionally loaded example than murder it’s not violating my free will to not let me walk into some random person’s house and steal their silverware; it’s my actions that are restrained, not my will.

Here’s a counter-example from fiction. In the old Lord Darcy series a character turns out to be a born psychopath magically restrained by a complex geas that forbids him from attacking anyone. His will is still free, but his actions are restrained. Less so in practice than they would be in a prison cell.

Is that ethical? Probably. It’s not even true mind control, just behavior control. It’s exploitable, certainly (a plot point), but not evil in itself. And probably easier than destroying somebody’s personality and crafting a replacement one like the original scenario.

I think a key factor is who’s making the decisions. With incarceration, we’re talking about a system which involves dozens of people; police officers, prosecutors, defense lawyers, judges, juries, prison officials, etc. The scenario the OP described has one person making unilateral decisions.

My instinct would be to encumber every confirmed psychopath with an external behaviour-modifying device, something like the geas in the Lord Darcy series mentioned above, or the slap-drone in the Culture series by Iain Banks.

Perhaps some sort of artificial conscience would work, a synthetic ‘Jiminy Cricket’ entity that could warn the offending individual if their behaviour becomes unacceptable; this might work, but I am reminded of the recent Puss in Boots:The Last Wish which included a villainous (and obviously psychopathic) Jack Horner who was accompanied by a completely ineffectual Jiminy Cricket-type conscience. I don’t think that an external constraint with no actual power would work very well. But an artificial conscience paired with (say) a shock collar would cause even more problems.

To change the psychological substance of a human mind without profoundly damaging or destroying their individuality is probably impossible.