Teddy likes to jump JUMP jump
Cause he's a clever pup pup pup
He knows good things are up up up
But cause he's not a lump lump lump
Teddy likes to jump jump jump
An ex pen is good for fencing off open concept spaces, or you can put him behind a gate in another room, tether him, or put him in his crate.
Basically- "teaching him a lesson" isnt going to work at this stage. He is a dog, he has less understanding of "right vs wrong" than a 2 year old human, and no chance of learning it. He will just learn what he already has - it's only ok to eat from the counter when Mom's not there, and it's a great game to figure out how to get it. As a dog, long term consequences are something he wont really grasp either. Counter surfing is SUPER rewarding for dogs, it hits all the buttons - working for their food, the roulette of "oooh, what good thing will be there this time", scavenging etc. Super fun, very hard to untrain.
Right now- it's your job to keep him off the counters by whatever method possible so he can forget that fun game before it escalates further- I have one colleague with a toy poodle that would jump onto the counter and get food from onto of the fridge, another whose dog will open cupboards to pull out bread or anything else. Tether him to furniture, baby gates, crate, etc. If the humans are doing their job, he shouldn't be able to be unsupervised in the kitchen - ever. At least for the next few months. Annie was not left alone unsupervised in my kitchen for her first 8 or 9 months, maybe more. I leave dirty dishes in the sink, so at my house, a gate is always on the kitchen if I am gone. At moms, no food or dirty dishes are ever on the counters and I still double check counters before I leave.
You may also want to later work on an alternate behaviour for in the kitchen - Annie has a spot that if she lies there, food appears between her feet. She likes that spot A LOT, and we work on down stay there. If she is in her spot when I return to the kitchen - food usually appears.
Ptp- I would suggest what I do, which is a scrunchie to close the cupboard doors... but umm..... I think that's probably an even worse idea than leaving them open in your house

.