Spain has separation of powers. The courts declared the action illegal and directed the police to end it.
The organisers knew of the court's decision and still went ahead. That is reckless.
If they wanted to protest they could've organised demonstrations and protests - which are perfectly allowed in Spain.
I don't think the use of public money for the illegal act necessarily sets a bad precedent. The constitution didn't say to go out there and spray rubber bullets at civilians. So how a government can respond to this illegal act is a subjective choice.
Spain could have chosen to use less authoritarian methods to deal with the consequences of this ballot without setting any precedents. It could have been declared unenforceable by a court, which is a more appropriate venue.
Nobody expected them not to react to the referendum. Using cops with clubs instead of lawyers was disappointing.
>that constitution doesn't hold weight in real life
We will see what carries more weight, violence or paper.
Democracy must be tolerant of peaceful protesting. An "illegal" vote (depending who's lens we are viewing this from), to me, is a form of peaceful protest. Candor, mutual respect, and peaceful organizing are some of a few tools democracies have to solve problems without devolving to unrest and violence. If we assume we highly value avoiding violence (and we should), governments need to tolerate the use of these tools, from time to time.
By banning the use of these more moderate options, the national government is essentially promoting dissenters to even less desirable options so they have at least some form of expression. I think we should be surprised the national government chose to use such force when it had far less invasive means for dealing with the consequences of this vote, e.g., courts.