Hi anon!
This is so weird. I honestly don’t know why he does this. I think it might have started off as excitement or attention-seeking and now it’s a learned behaviour? That’s just an educated guess though. Here’s a guide to interpreting dogs’ barks so maybe this will help figure out what he’s trying to communicate.
Here are a handful of links to dog forums where they discuss barking. They might have some better advice there for you.
Otherwise, I would recommend doing some activities or training that are incompatible with barking when you’re outdoors. Teach your dog a formal to-hand retrieve! Teach him to find a decoy! Play some nose games! Once he can be near you outside without barking for a few seconds*, then I would reinforce quiet = your attention. If he starts barking, you leave. Obviously this won’t work on walks, but it would work in the yard.
Hope this helps! Keep us updated -C
*I wouldn’t recommend starting the quiet = your attention right away because I think he could start attention-seeking barking and that wouldn’t be great. Once he understands that he doesn’t HAVE to bark when you’re outside with him, then start reinforcing it with your presence.