I feel your pain. I've had the _worst_ luck crossing the US border with a TN. And I'm a white male Canadian, you'd think the racial stereotypes would be in my favour.
Many CBP works simply do not know the rules as you said. I've been pulled aside for 3+ hours. I've almost missed flights even though it's 110% legal for me to be here and work. I was pulled aside for not having an I-94 paper in my passport even though they had switched to a digital system for Canada and Mexico 5+ years ago (aka NO ONE has the paper). I've had border officers give me off hand remarks like "It's a shame an American wasn't given this job" looking at my TN application. All you can say is yes/no sir/ma'am and hope they're not having a bad day and send you back.
Then other days I'm waiting in the line at LAX getting back into the country, they ask where I had been, give me a stamp in two seconds and wave me through. I never know exactly how they're going to react.
It's gotten to the point where I'm treating getting a green card at this point the same way someone treats buying a lottery ticket. If it happens that's great. But if it doesn't I already have a backup plan of banking up all my USD and moving to Europe (my immediate family all live there and I have a British passport from my parents).
The immigration game is all fine and good for me now (29 years old, single, no mortgage and no kids). But even if I make half the amount of money in Europe at 33-35 when I want to start a family would be worth it to know that I don't have to worry about being kicked out the country. I especially feel for my close Chinese friend who can't even re-enter the USA right now if he goes back to China.