It didn't always have to turn into an infection as there are plenty folk methods of preventing that from happening used throughout history - from wound cauterisation to my regional bread + spiderwebs.
The latter was given a scientific explanation in modern times: the webbing contains live penicillium fungi in quantities sufficient to act against microbes.