99.9% of visitors do pass, because they are consistent with certain profiles--business visitor, tourist visitor, never-been-anywhere-bad visitor. Even for them, it's a rather unpleasant and rude experience that leaves a bad taste.
There's no question that our border control and immigration system needs an overhaul. The stupidity and counter productivity of the agents who scrutinize every incoming person (except for a few thousand Mexicans every day, but that's another topic :) inspires little confidence that they would actually recognize a terrorist, who would undoubtedly be carrying a false or sanitized passport to avoid just such questions.
I'm sorry that happened to the submitter, and I hope he'll give us another try some day. If his story gets out to the right person or persons, it might even make a difference. I'm not convinced that Border control people will ever hear about it if posted here, but he can contact them directly: https://help.cbp.gov/app/answers/detail/a_id/175/~/complaint...
By the way, this kind of profiling or over-profiling is not confined to U.S. Border Control agents. I have seen identical behavior by Canadian agents, too. All I had to do was mention I was going to take a class, and the guy made us go into an interrogation room where he asked repeated, annoying questions to try to entrap me into admitting I was in Canada to work or some such thing. I was born in Canada as it clearly states on my US passport, and he asked me where I was born, then looked at my companion with a sneer on his face as though to show his disbelief. It was entirely unpleasant, but in the end we passed. I learned not to say I was there to take a class. Just visiting. Hope to spend lots of money. Ok, have a nice day!