It can be a rational or irrational choice depending on the available treatment and the specific case. A blanket statement that says "do not resuscitate" ignores cases where resuscitation could have been successful and where the chance of revival outweighs the risk of undue pain and suffering.
In a world where the only available treatment is blood-letting or getting your limbed sawed off by a hacksaw, a "do not resuscitate" policy is clearly more rational than in the Star Trek/sci-fi world where treatment consists of a doctor waving a magic iPad over your head and nanobots cure you painlessly. Since we're somewhere in between those two it becomes more complicated, but evaluating the risks and benefits and making an as informed choice as possible based on the available information still seems to me to be the rational way to look at it. Making future medical decisions based on an emotional reaction to individual cases, on the other hand, seems to me to be irrational and counter-productive.
The choice of how much pain is worth it for how much of a chance at a longer life is going to look different depending on your religion, your responsibilities, your age, your experiences with pain, your family, your culture, etc. And yes, of course the cost of treatment will factor into that decision for both the doctors and the patient.