How to weigh these pros and cons of applying to PhD programs? I know people have posted LOTS of questions about whether they should apply to PhD programs, but I haven't seen some of the issues I'm currently facing addressed. 

I'm currently a master's student in computer science at a top 15 university and am faced with the current pros and cons:  

Pros


I strongly prefer research to software engineering. Apparently this is the only valid reason to get a CS PhD (other than wanting to become a professor, which I don't), and this reason is certainly true for me. I've worked on 3 research projects, all of which I have found vastly more interesting than the software engineering internships I've had. I'm especially excited about finding solutions to unstructured problems, which apparently is the core of doing research. 


Cons


According to what I've read, it's likely that even if I get a PhD, I'll end up in software engineering anyway. That's a lot of time and energy spent on something that will end up having little effect on my career. Ideally, I'd like to get an industry research position somewhere like Google, but from what I can tell, only a select number of superstars get those types of positions. I spent my 20s chasing a similarly uber-competitve pipe-dream, and I'd rather not waste my time on another one. 
I'm 34 years old. This fact has two repercussions: 


Continuing to get paid very little for 5-7 more years seems flat-out irresponsible at this stage of my life. I wiped out my savings and took on loads of debt to quit my job and go back to school. I'm afraid that if I don't to make as much money as possible as soon as possible, I'll end up having to resort to eating cat food when I retire. 
If and when I do graduate with a PhD, and if I'm unable to secure a research position and go the programming route, I'll be a new entrant to an industry that is notoriously ageist in my 40s rather than my 30s. 

PhD programs are, infamously, very stressful, and I'm not sure I want to put myself through that. I've had chronic depression for my entire adult life (albeit managed and medicated), and I honestly wonder if I could handle the anxiety that PhD programs apparently bring. The PhD application process alone seems enormously intimidating and demoralizing to me. 
I frankly just don't think I'm a competitive candidate. My grades are excellent, but I'm not currently at even a top-10 school and I have no publications or good connections to professors at other schools. I also just had a sort of falling out with my current advisor, who's famous in his field, and I'm probably not going to get an LOR from him. I've heard that publications don't really matter in PhD admissions, but I'm looking to apply to top-five schools, where, based on bios I've read and students I've met, they do matter.   


Given all these considerations, does it seem obvious that I shouldn't apply to PhD programs? Research seems very alluring and fulfilling to me, but these various drawbacks make it seem like it may not be worth it.
My advice is do a serious job search now of salaries and do a rough "expected value" calculation of how much more money you would make with a PhD compared to without one. Perhaps even ask any contacts you have about this. Then you can see if that amount is worth it to spend four years doing a PhD and the possible better job you might get with one, if it would indeed be better. Money is actually pretty important, so it's a good idea you have an actual figure in mind, even if it is a rough estimate.

My next recommendation is to expand your school applications if you do go for a PhD. If it's enjoyment of research that you're after, the top schools won't necessarily get you a better experience. You'll do better at a less stressful school based on your mental makeup. I did not personally find a PhD very stressful and I think applying might actually be the most difficult part.

I'd also like to say that it's not really necessary to be extremely competitive to get a great career. Most people who will compete with you at all levels of education and career will just go on to do something so different from you that they won't even matter one year down the road.