Socialization is important
Back in the 1980s when Dr. Ian Dunbar started doing puppy classes, one of the things that he emphasized was getting puppies out to see the world, socializing them to things that they would experience later in their lives. And this remains important today. Puppies that are not taken out in public until they are older have a much higher likelihood of being afraid of all the new things they see, hear and smell because those new things were not part of their world during the critical socialization period - the point in a puppy's life when their brain is primed to accept things as normal.
And when is this window? It varies depending on which expert you talk to, with some saying that it ends at 12 weeks of age and others saying it lasts up to 16 weeks of age. Odds are good that it varies between puppy to puppy because they are individuals. And it doesn't mean that we can breath a sigh of relief and settle in at home once our puppy reaches 16 weeks of age, we should still maintain the puppy's exposure to things so they continue to view them as normal. It does mean that similar to how children's brains learn new languages faster than adult's brains, the brains of puppies under the age of 16 weeks are primed to accept things they see as normal parts of life. After 16 weeks of age, a new thing is much more likely to be greeted with suspicion.
More and more we are recognizing the importance of socialization, and balancing it with the need to protect our puppies from infectious diseases. It is always important to weigh the risks and benefits of going different places with your puppies. The greater the number of dogs of unknown vaccination status that frequent an area the higher the risk to your puppy. For that reason, high traffic areas such as dog parks are not recommended. However, if we go to the other extreme and keep our puppies on our own property until 16 weeks of age we are at a much higher risk of them becoming fearful so it is a matter of weighing the risks for your individual situation.
But it's not the whole story
You know the kind, the dog that stares at you after you give a particular cue, waiting to see evidence that you have a treat that they will get. If that evidence is shown, they respond to the cue. Otherwise, they high tail it off to investigate better options. A frustrating loop to find yourself in!
Likely the dog has learned that if there is no sign of an immediately available reward, that there will be no reward forthcoming. I'm certain that you didn't intend to teach this - but it happens fairly frequently without us being aware of it. The good news is - it is fixable.