The problem is that the rest of the world doesn't want to - not can't, but finds it inconvenient - to deal with the ramifications of supervising or caring for people in public, strangers, who can't help themselves.
It's much easier to detain inconvenient people than change the rest of the world around them such that it wants to share the burden of caring for them.