Bacterial and archaeal viruses are replete with diverse uncharacterized accessory genes (AGs), which likely interface with host processes. However, large-scale discovery of virus AG functions remains challenging. Here, we developed an integrated computational and experimental discovery platform to identify viral AGs and assign functions. We show that multiple AGs activate unexpected programmed cell death (PCD) activity of distinct restriction-modification (R-M) systems. We describe an exapted type I R-M decoy that kills the host upon sensing several different anti-defense AGs and a self-guarded type III R-M system that restricts phages but also induces PCD when bound by anti-R-M proteins. Other phage counter-defense genes additionally activate non-R-M-based abortive infection systems encoded by prophages. This defense strategy creates a conundrum: lose AGs and be exposed to immunity or keep AGs and trigger PCD. Strategies employed by viruses to avoid this double bind could be an important factor in virus evolution that remains to be explored.