Wait, in France the sentencing is done before trial? Why would he already be sentenced to 5 years without first being tried or convicted?

You can appeal, and until every legal options have been pursued a verdict is not final. Since you're innocent until proven guilty, and you cannot be guilty untill all options have been pursued, you're free until the appeal has been completed.

No, he was convicted, put in prison, appealed the verdict and was released after 20 days waiting for the next trial

There was a special law (that his party voted for btw) that added sentencing enhancements for the specific crime he did iirc

It's surprisingly often the case that criminals assume everyone else is doing what they're doing, and want harsh punishments for it.

(see also: the rates of homosexuality among homophobes)