Understand Dog Behavior
Rule #1 is that dog behavior is learned. Learning begins early on and within the litter. A weeks old suckling pup is already learning, it may receive a nip or nudge from it's mother should it become obtrusive or disruptive.

Mother nursing her pups.
Dogs are animals of opportunity and will continue to learn life long by these very means. This is what's known as "action and response" and the principle applied to nearly all dog training methods.
Certainly your dog provides you with love and companionship. As most people do, I as well tend to portray human emotions on dogs. While this human like bond is what makes a dog "mans best friend", your dogs see things in a different light.
Purpose..
Most all that consumes a dogs mind has a purpose and yes, pleasing us is a purpose which works well in our favor. Understanding dog behavior and how dogs think will give you a major advantage in both training and achieving the desired behavior of your furry friend.The canine mind views a sequence of events in a more immediate way. People tend to humanize their dogs in a sense that they understand punishment and pleasure. What a dog understands is consequence, what is achieved via action. The result, if desirable will be repeated. Here we regress to the basic principle of action and response.

It is common knowledge that dogs are pack animals that willfully will do what ever it takes to maintain their position amongst their pack. This works for us, "humans", as they want to please. Or, on the other hand, dominate to lead.
As much as I love my dogs my belief is that there is no "limbo" for our dogs, they either lead, follow, or blend in.
Companion dogs by nature are pack animals and in one way or another will seek to find their position in your home, your pack. Yes in a dogs mind they will instinctively view their human family as members of their pack. By projecting your position as alpha your pup will be confident and secure among your family :)
Problems like barking, chewing, jumping up, marking and destructive behavior are all acceptable in the canine world. It is our job to condition and train our dogs what is right and what is wrong. Most all dogs aim to please their owners, yes, yours too :)
Dogs can read our body language and emotion quite easily and often will react to an angry gesture. For instance, a puppy that just peed on the living room carpet will in many cases show remorse by cowering, lowering its head or hiding as u hastily clean up the mess.

Caught.. Being a dog.
Again, we can over think what's on the minds of our pets and honestly, probably not that much, maybe a second or two worth of reality. It's all about the response achieved by their "current" action. A watchful eye is key here as we must teach our dogs what is right and wrong.
Can dogs feel punished? Maybe so if they return after a half hour while you stood out in your pajamas calling, only to be corrected and scolded upon return. This is why timing, command and correction is so important. On the flip side, click, praise and treat your pup and the wrong point and your point is mute.
To yell, scream, hit or crate your dog for bad behavior will not resolve the issue. We must look at things like a dog does, it's all fair game remember?
Dogs by nature are social creatures and thrive to interact with their human counterparts. They should also receive ample exercise and social time within your family. A pent up, bored or neglected dog is more apt to show troublesome dog behavior than others. With training you must always stay consistent.
As mentioned, dogs learn by action and response. Consistency, repetition and reinforcement of commands are key to successful training be it by positive praises, or correction reinforcement.
To the top of understanding dog behavior.