All the less-wealthy and "more corrupt" places I've traveled were far easier to deal with at the border. It's happened so many times I've lost count that the border agent didn't even look at me /or/ my passport before stamping a random page and yelling "Next". This doesn't happen in countries where the person at the border is well-paid and engaged in their job, it happens when they are bored, disinterested, and just want to go home. With one exception, all my worst border experiences were in wealthy countries. The one exception I won't discuss in detail publicly, but it was while leaving, not arriving, and at any rate wasn't due to their border agency but rather their secret police mistaking me for a journalist.
Another observation I have is that only foreigners really get the worst treatment, so this may be why I haven't felt so badly about the US CBP, while I hear from my non-American friends and acquaintances that the US is the worst one to deal with. I'm sure any citizens of the countries I've mentioned will be quick to defend them in the comments in reply. After all, when you're a citizen, it's generally pretty painless to get back into the country of your citizenship. As a foreigner you face more scrutiny and have less legal protections.