You'll see that in many cases, when any sort of cell enters a zone of intolerance or zone of physical stress, the replication machinery gets put on the backburner (and thus replication). Expression of stress-response proteins like heat shock proteins is increased as a result (1). If a cell isn't within acceptable parameter to undergo division at G1 or G2 (anoxic environment, etc.), you'll find mechanisms like G0 phase or sporulation are preferred until the environment returns to something less stressful (2). I wouldn't say cells would rather be immortal, per se, but longevity or even apoptosis/entosis/etc. would be preferable to replication if nothing is going right (3, 4).
To be clear, when we're talking about evolution that's a tough one. Sure, some sort of stress-response transient signal could induce some lasting cell memory selecting toward a specific function. I simply don't have the data to quote you in that aspect, however.
Biology of the heat shock response and protein chaperones: budding yeast (Saccharomyces cerevisiae) as a model system.
Slonczewski, J., & Foster, J. (2011). Microbiology: An evolving science (2nd ed., p. 143). New York: W.W. Norton.
DNA damage-induced apoptosis
Cellular Stress Responses: Cell Survival and Cell Death
As a footnote, while replication does occur in sporulation, the replicated chromosome is destroyed in the process of forming the actual spore.