Which Medical Procedure Makes the Most Sense Financially?

No, I’m not asking for medical advice, but I’ve become awfully curious about the logic of the medical industry in certain cases.
Example one: A coworker who is in his 70s, and overweight, recently had to have knee replacement surgery. Based on information I’ve been able to gather, he’s been severely overweight for approximately 20+ years. I’m guessing that at least part of the reason his knee had to be replaced was because it wasn’t designed to be hauling around 300+ lbs for 20 or more years. So, what’s the cost of knee replacement surgery, compared to that of gastric bypass surgery or liposuction? Is it possible that if he’d had either of those two surgeries, either when he became severely obese, or instead of his knee replacement surgery, that it would have fixed the problem with his knee going bad? Or at least reduced the chances of it going bad later in life (assuming he’d have had one of the other two surgeries 20 years ago)?
Example two: A cancer survivor discovers that she has a mysterious lump in her armpit about the size of a golf ball. The lump remains, despite treatment with oral antibiotics, and causes discomfort to the patient. Rather than remove the lump (which could be done as an outpatient procedure), a biopsy is performed on the patient to see if its cancerous. When the first biopsy is inconclusive, a second one is performed, which reveals that the lump is cancerous.
Now, in the second case, assuming that second biopsy had come back “Negative,” the patient still would have wanted to have the lump removed, because of the discomfort it had caused them. Am I wrong in thinking that the during the first biopsy, if not the outpatient procedure to remove the lump, it would have been obvious that the lump was not the result of an infection? (Granted, the likelihood of the doctor being able to tell if the lump was a malignant or benign tumor by eye is vanishingly small, but I’d think that a pus filled sack and a tumor would look a bit different when viewed by the naked eye.) So, shouldn’t they have just removed the lump to begin with, and then done biopsies on it once it had been removed from the patient?
Mind you, this patient is middle class, well educated, and has access to good insurance, so they’re not some schlub with a shitty policy, and no money to cover things out of pocket. Additionally, the only reason this patient is alive today is because they were able to get an experimental drug which cured their particular form of cancer.
So, am I wrong in thinking that in the case of patient one, it might have been better to lipo him or perform a gastric bypass, rather than replace a knee? And that in the case of the second patient, as soon as she reported the lump in her armpit, it would have been better to have removed it?

I’m sure there are all kinds of factors at play, but one is that doctors do seem to be overly cautious nowadays. Perhaps that’s due to our lawsuit happy culture. Another issue is I think many doctors simply don’t know the costs of things for their patients. My doctor was flabbergasted when I told her how much a single check up appointment costs. And we have supposedly good insurance with a Fortune 100 company. And MRI’s, they use those things like candy, with good intentions I’m sure, but not knowing they cost $1000+ every time.