Umm, the mutations are random. The virus doesn't change itself because you've become immune to it. Also, immunity to a strain of a disease can help protect you from a slightly different strain of the same disease.MERS and SARS are Covid viruses. You don't seem to grasp the reason why viruses mutate.
Antibodies from earlier exposures affect response to new flu strains
Research highlights role of immunological imprinting -- or how the immune system fights the flu after previous exposure to the virus via infections or vaccinations -- in the elicitation of new antibodies.
www.sciencedaily.com