Coming back to the original question of why war happens, and why people don't just reject it: OP, have you come across the prisoner's dilemma? It shows a particular type of situation where the incentive for the individual leads to action which is worse for the group as a whole.
The example is where 2 members of a criminal gang are arrested. The police don't have enough evidence to convict the pair on the principal charge, but can sentence both on a lesser charge which means both prisoners get a year in jail.
The police offer each prisoner a bargain:
- If one prisoner testifies against his partner, he will go free while the partner will get three years in jail on the main charge.
-but if both prisoners testify against each other, both will be sentenced to two years in jail.
-if neither testify, they'll both get one year in jail on the lesser charge
You can see that the best situation all round is for both to stay silent, and get a year each. But if a prisoner only cares about their own self interest, they are always better off testifying: if the other prisoner also testifies against them, they get 2 years in prison instead of 3,; if the other prisoner stays silent, then they get let off completely instead of serving 1 year.
But that same reasoning holds for both of them, so the consequence is that both prisoners will testify against each other - and so each will serve 2 years even though they could have both served only 1 year if both had stayed silent.
Armed conflict is the same type of problem as the prisoner's dilemma. Peace is much better for everyone. But if you can't trust the other side not to use weapons, then you're always better off using force yourself. If they weren't going to use force, then you gain an advantage. And if they were going to use force, then you are able to defend yourself instead of being slaughtered. So both sides fight, and both sides are worse off than if neither had done.
Breaking that conflict of interest was the driver behind the EEC after WW2, which eventually became the EU. By building trade links, each country's self-interest became more aligned with the whole group continuing to function. So instead of choosing the best thing for ourselves with no care for the other countries, we had an incentive to take a risk and hold on, gradually building up trust with each other that we'll all act in the interests of the whole group. Which - if everyone continues to act in good faith - ends up benefiting us all individually. And in Europe that worked.
There are other complicating factors in Israel/Gaza.
But hopefully this is a useful perspective into 'why'