Right to assemble is not a blank check for violent action, or even to assemble wherever and whenever your want.
Your right to assembly remains. You just made a risk-adjustment decision about not participating in a riot. The correct thing to do is go home, regroup and join the protest leadership to help plan another protest where the hooliganism is kept in check.
Also, not being in Serbia myself I'm reluctant to make judgements from afar about what degree of hooliganism is justified in this case.
Correct. Escalating from peaceful to violent protest shouldn't (I'd argue cannot) be responsibly decided in the moment.
If you went to a peaceful protest "that was starting to get a bit rowdy," the situation clearly changed from underneath you. Go home. Take stock. Decide if what you saw was random rioting or targeted violence. If the latter, decide if and how you can help and if it will make things better or worse.
I'm struggling to imagine non-Hollywood scenarios where someone showing up to peacefully protest is useful when it effectively escalates to civil war.