If I read it right the guy had already ignored multiple court orders to stop what he was doing, and once you ignore any court order the judge tends to get left with not much other than to impost custodial sentences, especially if what you are doing to get those orders involved harm or harassment of others.
If nothing else the court has to try and show that you can't simply ignore the law, and the lower penalties. It's a similar reason you'll sometimes see someone go to jail (albeit typically for a couple of nights max) for actively refusing to pay a small fine.
I haven't read anything about previous legal action but you are spot on about how judges feel about such actions.
I have managed to read the full comments from judge in some quiet moments and he the most serious charge was actually over a long enough period that he had to apply the earlier pre-2017 Stalking sentence guildlines.
That meant a maximum of five years on the charge with the resulting two and half years given. It could have been doubled under the newer guidelines. It would also have been longer but he allowed the mitigating factors of remorse, good character references and no previous convictions (paraphrased) to offset the additional time he would have added to the starting point.
As it stands, up to one half the total sentence must be served in prison and the remainder can be on licence, so he may not be in for that long in reality.
He will face up to five years for breaching the restraining orders against any of his victims though, so he better be true to his remorseful words.