Stuffing treats in your dog's mouth does distract them, and I suppose if you do that consistently, they can learn that way eventually. But it's not a method I'd ever suggest...or if I did it would not in any way be an end game, meaning that the puppy in question is still untrained, just distracted! At some point you have to convey to your puppy that it's not okay to leave your side to go and greet anyone, no matter how enticing, until released to do so...and the safest and most reliable way to do that is with a leash!
The plain truth here is that a 5 month old puppy is typically not 100% at anything, let alone being off leash and listening to commands when there are much more exciting things around! And when out and about aren't there always?
For me, a puppy that listens well in most cases, but fails to recall when sniffing or when people approach, is not ready to be off leash! Or, only ready to practice that in secluded places.
For every dog I've ever owned, a leash is a training tool only. The end goal for me is and has always been dependable off leash obedience. So I totally understand what you're after...
Traffic? My current puppy was always what I call "traffic tolerant" but in no way was she "traffic wise" at 5 months! Meaning that while cars don't scare her at all, if she were to see something, like a nice person to greet, across a busy street, would she watch and stay out of the way of traffic to get over there? Most likely not! Teaching a puppy to be traffic wise takes some time. And I don't think I've ever seen a traffic wise puppy...except for street dogs who live or die by their witts!
At any rate, what you're ultimately after, 100% off leash obedience is totally doable. And, depending on the puppy, you might get there if you keep going the way you have been. Of course the flip side is that you might not. It's soooo much safer to train these things on leash though! So my advice would be to hedge your bets and let this pup learn some of these things on leash, let her mature a bit, then proof that learning off leash!
It's not the size of the dog in the fight, it's the size of the fight in the dog. Mark Twain