I think @syz may be right, about the territorial aggression. I’m no expert on dogs and I don’t really know much about goldens, or any breed for that matter, but I experienced something similar with my dog when I took her with me on a two week visit with my aunt this past Christmas. There were times when I had to pen her up in a fairly large workroom in the basement and when she was down there she would bark, kind of aggressively, at my aunt, anytime time she went down into the basement.
The workroom was just to the left of the bottom of the stairs. That behavior continued for the whole two weeks I was there. At a certain point I started to refer to my aunt as “upstairs DeDe” and “downstairs DeDe” because Lizzie was fine with my aunt, she just loved her, upstairs and anywhere else in the house, or the yard or in the van, but Lizzie just barked and barked at her whenever she was penned in, in the workroom in the basement and DeDe went down there, even though, of course, my aunt was exactly the same person she was upstairs as she was downstairs.
She saw the workroom was her territory, I think, plus, penned in there, she had no where to run. If she sensed a threat of any kind there, she would have been backed into a corner, so she had to defend her space; no other option for her, no option to run.
And if it was unusual for the dog to be penned in and there was a lot of activity and commotion, that was out of the ordinary, like a lot of noisy kids around at a child’s birthday party, that could have added to the dog’s stress level.
But, like I said, I’m no expert. Lizzie is my first dog ever.