Welcome to Flyertalk, POBOY.
I'm sure it's not too much comfort, but I don't believe your situation is out of the ordinary. Some security personnel are polite, some are not. Most are incompetent.
As for being escorted to the gate, that is quite normal. I would presume it is done to prevent you from retrieving anything after you have been searched though it does have the benefit of keeping you from waiting in line again.
One tip -- don't be the first to board. Stand back for a few seconds and let one of the other first three to board be "randomly" selected.