A neighbour has a border collie - started off a really nice dog, very obedient. Thinking they were being good to the dog they let it have free run of their paddock for hours at a time, mostly unsupervised. The paddock had a couple of sheep and some hens. Along one side is a lane which is goes to other houses and is a footpath. There is no shelter, kennel or hidey hole in this paddock. So, from the dog's perspective, having been given the job of guarding the paddock and the sheep and hens, the dog began to do just that. Over time it developed habits - it would run the fence and bark at vehicles, it would bark at people on the footpath and run alongside them, growling and barking. It would chase the sheep round if it was stressed. What was a nice dog became very very stressed. The neighbours are not the sort of people I could explain to what they were doing wrong, and it upset me seeing this dog. They would have been much better keeping the dog feeling safe and protected in the house or kennel and to exercise it by walking or playing with it in the paddock.
Not sure if this helps, but maybe your dog needs more protection from the scarey world outside?
PS neighbours are now to build on this paddock, took a perimeter fence down and got rid of the sheep but still left the dog out there unsupervised! Guess what? it wandered off to find some more sheep to play with! Luckily for it they were our sheep and it's still alive, had it chosen the sheep in the next field it would have been shot!