Interestingly, if you read the prosecution's sentencing memo, you see that protection is the core reasoning behind the long sentencing recommendation:
Barry Ardolf is a dangerous man. He uses his technical skills both to inflict harm and to avoid getting caught. Indeed, there is every reason to believe that the victims identified in this case are not his only victims. When Barry Ardolf is released from prison at the end of his term of commitment, he will do something like this again to someone else who has angered him, only this time he will be even more careful. The only way to prevent that is to incarcerate him for a very long time.
I'm absolutely inclined to agree with them. The prosecution earlier notes that even in this case, Ardolf's letter to the judge expresses no remorse for attempting to frame his neighbor for child pornography at his place of work, claiming instead that he had been "victimized" by the neighbor. Ardolf sounds criminally insane to me. I'm glad he was locked up before he did something far worse.
In this case, 18 years seems pretty clearly excessive from a protective point of view; it's not even clear any jail time at all is warranted, since some sort of probation with supervision of internet use would likely suffice to prevent him from reoffending.
My impression is that many people, especially in the U.S., have a notion of justice that's either more retributive or deterrent based, though. If retributive, that's a pure ethical disagreement. If deterrent, then we might have an empirical disagreement, about which lengths of sentences in fact deter crimes.