I don't know how this works in other countries, but in the Netherlands, police can nearly always find a reason to make you spend a night in jail. We have laws against public drunkenness, against "unlawful assembly", etc. It's mostly used to break up bar brawls without having to gather too much evidence.
Stuff like this only works if the police is not terribly corrupt of course. But if the police force is corrupt (or, like in the US, continuously afraid of their lives + racially biased), then I'd wager there are bigger dangers to society than the ability to make someone stand by the highway for a while.
There are many countries that apply such a “punishment by delay” system ad-hoc. Police know a fine might not hit the sweet spot so when they see aggressive or speeding drivers they don’t just apply the fine but also an arbitrary delay: you’ll hand around by the police while they do checks, re-checks, verifications, more checks. This is far more frustrating than the fines and a good deterrent for those who consider any fine chump change.