"Eradicating" Hamas is a pipe dream as long as Israel continues to indefinitely occupy the West Bank and expand its (illegal) settlements there. Netanyahu and Likud can't admit that, though.
You have to undercut the legitimacy of these organizations. What Israel is doing now more or less makes Hamas's argument for them.
As long as Israel continues to occupy them, I can't blame the Palestinians for being as militarized as they are. Does that apply to suicide bombings or slaughtering people at a music festival? Absolutely not. On the other hand, if a foreign power came to my land, kicked my grandparents out of their homes, limited my freedom of movement, arrested my family and friends, and gave money and protection to settlers that want to take more of my land, I'd fight back. Americans started a revolution against the British for far, far less, and we're proud of it. But whatever the Palestinians do, they're labeled "terrorists" by Israel and many people here in the US. There's no recognition that the Palestinians have legitimate grievances and indeed the right to defend themselves. Why is Israel the only one that gets to claim that? The world is meant to recognize that Jews have a special right to the land based on thousand year old memory, but the Palestinians are told to get over what happened to them less than 100 years ago. That's unjust. And if that's what "peace" means, it's no wonder they don't accept it.
And as it concerns the US more directly, whatever benefit we get from our alliance with Israel (if you can call someone like Jonathan Pollard an ally), we pay a considerable price in image, principally but not exclusively in that part of the world. We can't say we're upholding the "rules based international order" and watch as Israel flouts UN Security Council resolutions, the Geneva Conventions, and our own laws concerning foreign aid to nuclear powers. We can't say we're in favor of self-determination and watch as Israel vetoes the existence of a Palestinian state against our own declared foreign policy. We can't have John Kirby cry about Putin killing Ukrainian civilians and then turn around and shrug off Palestinians deaths as part of war. But that is what's happening. And we're paying for it. In fact, we're legally obligated to pay for it. It's pathetic on our part, and it should be considered a national shame.