Your experience sounds utterly horrific, and I say that as someone who got trapped in a similar-but-different system many years ago and who's stilled carrying trauma from the experience.
There are two things going on in your story simultaneously, and I think it's important to separate them out:
Part I
The first is your tragic and unwarranted persecution by a Kafkaesque privatized system that has no business being deployed by any government anywhere - that's something revolting that the US has been doing for a very long time and it's obvious to anyone familiar with it how utterly evil it is. While your experience may have been relatively short (though I'm sure it must have felt like an eternity), a lot of incarcerated Americans are effectively indentured servants and it blows my mind that that's happening in the west in the 21st century.
Reading through the Wikipedia article on Private Prison was eye-opening. I hadn't realized how normalized this has become globally. And I must call out how interesting I find it that Israel is one of the only western countries to consider prison privatization and eventually rule it out as inhumane and illegal.
Part II
The second element of your story, however, I find deeply problematic. You keep mentioning these people who "haven't done anything wrong", yet you describe people who have overstayed their visas. Overstaying one's visa is a criminal act, and countries who care about protecting their citizens take it very seriously.
Citizens who don't believe that their borders need protecting are very naive.
Over a decade ago, I came to Canada to live and work, and when applying for my visa it was made crystal clear to me that my entry into Canada was a privilege, not a right. That even if I had all my paperwork in order, if the officers on border duty didn't like my face or my attitude they had every right to turn me around and send me home - or worse, such as in your case.
I had one harrowing incident in which border police suspected me of entering Canada on false pretenses, and it was terrifying because it's literally impossible to prove one's intentions. If, after a couple of hours of interrogation, I hadn't been able to convince them otherwise, they would have sent me packing and my entire life would have taken a very different path indeed - I would never have met my wife, and we'd never have had our son, and just thinking about that really freaks me out.
For the three and a half years that I lived in Canada, I was made very aware by the authorities at every turn that Canada was not my home, and that I had no claims or rights except for those explicitly granted to me in my visa, even after marrying my Canadian wife who bore me a Canadian son.
We ended up moving to South Africa to live with my family, where I still have citizenship. For six years my wife was on a spousal visa. She was not allowed to work, or study, and every couple of years we went through an ugly, mean-spirited (and privatized) bureaucratic experience to allow her to continue living there even though her husband and son carried South African passports. I say this to illustrate how the US and Canada are not edge cases when it comes to immigration and visas, but absolutely the norm. And I doubt you'd get any better treatment anywhere in Asia or South America. Europe might be a different story, but they're so relaxed about their borders that they're being overrun by hostile foreigners so I'm not sure that that’s a good example to anyone.
...
In conclusion, the awful stuff you experienced is awful, and unjust, and it's important that the American people understand what their systems are doing regardless of whether those trapped by them are innocent or not. At the same time, immigrants and foreign workers should be fully aware of the limitations of their rights, and know not to test those limitations.