@Snoopy. Dog’s mouths are not really “filthy”, as you said. In fact, if I had to choose whether to be bitten by a dog or a human, I would choose a dog. Human bites are far more serious (taking the rabies issue out of the equation, though humans can transmit rabies too, but I digress) than dog bites. As far as why they lick their wounds, it probably has more to do with keeping the wound clean from dirt and other bacterial/fungal contaminants (just like it is always recommended for you to wash a cut or scrape with soap and water). The bacteria in a dog’s mouth are relatively benign, and much less likely to cause a skin infection than the staphylococcus or streptococcus from the dog’s skin. So, it makes a lot of sense for the dog to lick its wounds. Not having the dexterity to scrub the wound or access to soap limits their options…
So, to answer the question at hand, licking the wound prevents rather than encourages infection (assuming the dog doesn’t have a conscientious owner who cleans the wound for them, which would be best).