While Thailand is certainly within their rights to run their justice system how they want:
1) The punishment doesn't in any way fit the crime.
2) "He's such a hero" is a terrible reason to do something. Focusing on who the person being wronged was is a bad path to justice - it is better to focus on what the perpetrator did.
So I hope the courts in Thailand would have found in Musk's favour.