I can't speak for anyone else but I trained Jimmy and Misty to hate the postman by showing them videos of Postman Pat whilst shouting "bad man, kill, kill kill". Just my small protest for all the bills and junk mail I receive every day.
I think the real reason dogs hate postmen is , as you say, territorial. Out of the blue this stranger they never see invades their home by popping strangethings through the door and the dog feels threatened. The dog barks and the threat goes away, the dog thinks "result, I did that !" so does it every time in the future, protecting his territory from the unseen enemy.
I know someone with a Cocker/Springer cross (also called Jimmy) who got the postman to deliver the mail each day for a while wrapped in clingfilm with a treat on the outside for the dog. This was partly so Jimmy would look forward to the mail arriving each day without going crazy but the owner also gradually introduced new stages and eventually the dog learnt to bring him the mail while he was in bed each morning.
He does the same with the newspaper too.