Is it wrong to use mouthwash?
Killing those bacteria is self-defense of your health. The bacteria can cause gum disease leading to heart problems and tooth loss.
Killing Fluffy the Mining Poodle and eating her would likewise constitute self-defense of the hypothetical miners' health. Not eating would lead to muscular and systemic weakness, preventing the miners from escaping the cave-in.
Killing is not a sin per se. Killing can be a holy act -- for example, killing a robber, a rapist, or an enemy soldier in a war. Killing an animal for food is perfectly moral, but such killing should be done as quickly and painlessly as possible -- not because the animal has any rights we need respect, but because a callousness towards suffering tends to kill one's empathy towards human beings. The act of killing a dog or cat (or any other animal that trusts people enough to form an emotional bond with its owner) isn't itself a sin, but it's a sign of a person who has no respect for loyalty -- a sure sign of a sick soul.