Note that a given bacterium will probably have more than one restriction enzyme, so the viral genome probably won't ever run out of targets. Even if it did, restriction enzymes could suffer mutations that may change the specificity. When you talk about microorganisms, it's more accurate to think in populations rather than individuals, since the colony would be able to grow again if they have at least one cell. Viruses need a certain density to spread, so even if the bacteria cannot defend against, it may be able to survive simply because the virus run out of hosts before some cells can be infected. This is even easier if the bacteria have some kind of resistance form.
Moreover, restriction-modification systems aren't the only defense line against viruses. Many bacteria have a system called CRISPR-CAS that acts like an immune system, inserting RNA fragments into the bacterial chromosome and using them as "antibodies" by hybridization. In this context, you can assume that restriction-modification systems, alongside other nucleases they usually carry, act as an innate immune system, while the CRISPR-CAS would be an analog to acquired immunity.
Diagram of the CRISPR-CAS system. Source.
Furthermore, not every environment has the same viral density. Some habitats may be protected against viruses by some means, like the gut microbiota (the carbon intake goes through the stomach acid and tons of hydrolases, which is very destructive for viruses); while some others may have an incredible amount due to lack of biodiversity and high cell densities (this is the case of most extreme environments). E. coli, as a gut bacteria, would probably have enough with only restriction-modification enzymes (In fact, while it have a CRISPR system, it seems to be repressed), while many others will need more defenses.