The analogy is valid, but the difference is not minor.
With infectious disease, if there are ten possible mutations to make the pathogen resistant to treatment, each with a 1% chance of happening within the course of the disease in one patient, then pretty soon all mutations would be present in most of the whole pathogen population on Earth, because of natural selection.
With non-infectious diseases such as cancer, in the same scenario, there would be about a 10% chance of the cancer cells developing one or more of the mutations in each patient, period. A tragedy for those 10% of patients, but a cure for the other 90%.