Snake are like any other creature. For the most part they are in an area for food or
shelter. Sometimes just passin' through. Hard to tell. Like you pointed out, it may have been rousted from its normal territory and looking for a new place; or following its displaced food source. Don't give it a reason to stay. You can also trap snakes, if you are concerned one has a foot hold on your property.
I would leave the dog off the leash if possible. It is unlikely the snake 'cornered' or trapped the dog intentionally. The dog likely upset so near the steps for security and the snake on the path that put it in front of the dog. A Cottonmouth will go after, even pin and animal or person. However, rattlesnakes are much more defensive. The best line of defense if you see another snake is to get a goose, duck, or
chickens in that order. Birds are probably the biggest predator of snakes in the wild. A adult waterfowl can stand their feathers up
enough to neutralize snake strikes; and will let them strike repeatedly until they can swallow its head. Then it is like a long spaghetti noodle. Of
course snake venom is not toxic in the digestive tract. It is a poison only in the blood stream, or in the case of a coral snake, in the nervous system. Fowl will eat them any chance they can get with no ill effect.
Be very careful where you put your hands this summer. Does not sound like this guy is about warning signals.