When I first beat the game yesterday I wasn't sure if I agreed with what Joel did. It's like those morality tests where they ask if you'd kill a child to save the world. Sure, no one wants to kill a kid but how many other kids would die if you don't? Upon further reflection and reading more of the backstory/lore of the world I'm on board 100% with what Joel did.
Sacrificing Ellie would give them a chance, not guaranteed, but a chance to find a vaccine. Not a cure necessarily (hold still Mr. Clicker while I give you a shot!) but a way to prevent future people from getting infected. Still it was only a chance, and I don't get what the rush was to kill her. Why couldn't they spend a couple weeks studying her instead of declaring "ok she's finally here, we're gonna operate and kill her in an hour, derp". Outside of Marlene being an impatient piece of shit, can't think of any other reason besides gameplay reasons (giving you a reason to rambo up the hospital right away).
Also, it's unclear how much finding a vaccine would have helped, given how fucked the whole country/world was at that point. It seems that most people were dying to other people, not the infected. Like the Firefly attacks in Boston, hunters in Pittsburgh and other places, cannibals like David and his crew. Maybe that was the point, that when shit goes free-for-all humanity can't be saved from themselves. Tommy had the right idea; I'm moving to fucking Montana when the zombie apocalypse hits.