How can you discourage territory guarding behavior?
I have a dog-friendly office and I take my puppy to work with me most days. He's got a little ex-pen area by my desk he hangs out in, when we aren't having playtime with other dogs or attending meetings. He's pretty content to be in there, with his chew toys and antlers and whatnot to keep him occupied. But lately he's started barking and lunging at dogs that pass by the pen. It's not crazy aggressive, but it's starting to feel like it could become so if left unchecked. If it happens when I'm looking, I'm able to ask him to "leave it" and then praise him when he's calm, but there are times when I don't catch it proactively. He's also randomly started doing it with his big brother at home (when he's just chilling in his pen there). Sometimes he'll lunge and bark at him when he passes the pen, other times he's fine.
Is there any way to discourage this behavior without having to catch it before it occurs? Or is that my only option? I don't want this to turn into a big problem with being aggressive about territory.