The people intending a purely peaceful display of dissent don't smash or set fire to anything, even if the people standing next to them do. Now, the court may have some trouble here with evidence because you then have to distinguish these people from one another, but that has become much less of a problem in modern days when everybody has a cellphone camera and police can be issued bodycams.
Either way this is a question of fact rather than a question of law.
> On top of that repressive regimes will routinely declare otherwise peaceful protests a riot at the first sign of violence.
Declaring something a riot shouldn't mean anything. If a specific person is breaking windows and looting they're breaking the law. If they're just standing there holding signs they're not.
It shouldn't be too much to ask to have the cops arrest the criminals and not the bystanders.