No, some dogs do not if the female gets away fast enough.
Male dogs have a "knot" at the end of their penis which enlarges once he begins to ejaculate. This knot causes the dogs to get stuck together, which ensures to the male that his sperm is inside the female. This prevents other males from breeding to her while they are stuck together, which gives his DNA a better chance of fertilizing her egg(s).
It is not guaranteed, of course, because a female can breed to multiple males and have a litter with many different fathers.