They do moreso according to the legal system that empowers them to be the best/most trained/authoritative at making assessments that can advise the judiciary when such decisions of social separation must be made.
Again, building a bomb without threatening to detonate it, is still a crime. There are plenty of times when someone on the verge of a psychotic episode requires state intervention and then medical assessments, treatment, supervision and then follow up.
The safety of society requires this and the state on behalf of society in which that person lives can legally infringe and restrict some of their rights and freedoms.