I wonder why Hamas became so popular in Palestine? Because strongmen who promise resistance against an occupier are always going to become popular, and seen as heroes, when there is an enemy who builds illegal settlements on your land and mercilessly murders your people, because Israel sees the Palestinians as less than human. You will see Hamas is more popular in Gaza than in the West Bank; this is because Gaza has overall suffered more under the genocidal Israeli boot than the West Bank has. The worse your physical situation gets, the more extreme, and more convinced violence is the answer, you become: it's pretty basic psychology.
So saying "The Palestinians should just boot out Hamas" is pretty damn stupid. Why would you boot out a group you see as your defenders, especially when you are crammed into an area less than 50km squared, under continuous bombing, and when you go for food, you are slaughtered along with your entire family?