The description you provide is for a specific bacteriovirus (a virus which infects bacteria). It applies to only one subclass of virus (in the case described, one called lambda).
Other bacteria infecting virus are not nearly so polite; they just kill the infected cell. As far as I am aware, there is no animal virus that has been demonstrated to behave in the same manner. Retroviruses do integrate into the host DNA but do not confer resistance on the host. So the suggested solution is a reasonable one for protecting some bacteria from getting specific virus infections; however I suspect the person asking the question was not the least bit interested in protecting bacteria from getting a viral infection! The principle is a good one, and might be useful if ever a virus if the type described was found that caused a disease in people.
One other interesting point: when a bacteria with lysogenized lambda virus (integrated into the genome of the host) is mated to a bacteria that does not have the same bacteria integrated in its genome, the bacteria that is mated with is killed by the integrated virus which escapes from the genome after it has been transferred (as a result of bacterial sex) to the sex partner. This is called "zygotic induction" and was described by Jacob and Monod (both Nobel Laureates) in the early 1960s. This discovery lead to the discovery of gene control proteins (repressors and later activators) which is a major area of research by people trying to understand how development is controlled.