Not all virus infections produce a protecting immune reaction in this manner. HIV evades the immune program by continuously changing the amino acid sequence with the proteins around the surface in the virion. This is recognized as "escape mutation" since the viral epitopes escape recognition from the host immune reaction. https://baglamukhi10628.uzblog.net/not-known-details-about-viral-45565252