It is similar to taking a candy from a baby, other than the candy is a cookie and the burglar is a lovable pug in this hilarious video. Anytime the baby goes for the cookie, the pug ensures to get it back.
Maybe the pug is presenting a life lesson of sharing to the new baby of the house. We learn to share our toys, our thoughts, and at some point this evolves into empathy and kindness but only in case we experience what sharing is at a young age. But, rather than showing the baby how to share, the pug is showing the baby what not to do.
It is all in good fun though, as the two socialize on the carpet. Many pets are overprotective of babies. This pug, nevertheless, is overprotective of his cookie.