A dog that steals something often becomes aggressive. It is not food aggression, just a type of resource guarding. The easiest way to get over this problem is to exchange what he has with something even better.
You can not just take the treat away. Go to your fridge, grab a piece of chicken or lunchmeat, heat it up in the microwave for a few seconds, and then get down on the dogs level. Look at the food and tell him "Oh, look what I have here, this smells so good!" Well, not exactly, but you get the picture. Eat a little bit of it, loudly, so he gets curious. If he stands up to look, but is still guarding this food, hide the food in your hands a little so that he is forced to come closer to look at it.
Dogs cannot resist this.
When you get a new puppy, this is something that can be avoided. Take the treat away at the very beginning and then give it back, immediately, so that the dog realizes you are not a threat.