So, for a long time, Israel was very socialist and had fairly good economic and social [in this specific context] equality. Don't forget that much of the original settlement of the land was done with literal communes.
There are three primary problems that make modern Israel so unequal - and, broadly, none of them involve water or security, which are fairly orthogonal to economic policy in Israel historically (the entanglement of socialism and doveishness on the one hand and liberalism and hawkishness on the other dates from the mid 90s at the absolute earliest, and probably more like the early 2000s), and water is water, though I guess a government less aligned with the kibbutzim and less obsessed with redemption through the soil might allocate less water to agriculture and more to industry...but partly for security reasons, Israel has always tried to be self-sufficient food-wise. Even today, only grain and beefare imported in any numbers, with Israel growing almost all of its own fruit, vegetables, eggs, dairy, and chicken (there's also a modest veal industry associated with the dairy industry; Israel has a very small difference in price between beef and veal as compared to the US, which is my point of reference)
The first is that following the entrée of the Likud/the right/the Revisionists/whatever into government, the country saw massive and often somewhat inept liberalization of the economy. While today this policy is hailed for planting the seeds of Israel wresting itself into being a completely developed nation, at the time it was fairly disastrous, at least in the short term, leading to hyper-inflation, the collapse (and subsequent nationalization) of Israel's largest four banks, and widespread labor disputes. The Yom Kippur War is also implicated by some for some of these problems, but considering that that happened in 1973 and most of these problems manifested in the early 80s, I have difficulties believing that. Interestingly, the solutions implemented were an interesting combination of liberal and controlled economics, with things like slashing government spending and ceasing the printing of money alongside strict price controls on a wide variety of items and conciliation with the all-powerful national union.
Now, Israel emerged from the crisis arguably stronger than before, but inarguably more unequal. Gone were the most ridiculous of the luxury taxes, and a relaxation of corporate laws made entrepreneurship much easier, and the early 90s saw an explosion of development, especially in the high-tech and service industries...though it's important to remember that Israel also accepted 10-20% of its population in mostly skilled immigrants at this time.
Keeping Labour in power through the late 70s and 80s might well lead to a less unequal modern society; I'm not sure it would get rid of the ultrarich, but it would probably pull the poor up a little and the middle class down a little. Don't forget that a lot of the ultrarich in Israel are Russian oligarchs who are probably getting counted in the inequality statistics, as are some rich foreign Jews who find it legally convenient to maintain residence in Israel for tax reasons or whatever.
It's worth noting, at this time, that a lot of the people with money in Israel date from before the state, immigrants who came in the 20s and 30s (or earlier) and built houses and started industries and so were in an excellent position when the refugees started pouring in in the late 40s and early 50s (they were taxed and controlled to oblivion at the time, but the government seldom seized assets outright). A ridiculous portion of Tel Aviv, for example, is still owned by the descendants of German Jews who built most of the core city in the 30s, and in Israel owning a few apartments in Tel Aviv pretty much makes you wealthy.
On that note, it's also worthwhile to point out the systematic racism against Mizrahi Jews that touched most of Israeli politics and society through the 80s (and today, though it's much less bad than it was, which used to be Irish-and-Italians-in-America-in-the-20s levels, more or less), the results of which still affect modern income inequality.
But in my opinion, the real reason for the inequality in Israel is one that lines up very, very well with your number of 21% in poverty - the Arabs and the religious. Israel, I've often thought, is not one society but three in parallel: "Mainstream", religious, and Arab. Even today, it's possible for a member of one of those segments to never meet a member of one of the other two their entire life, and even just 10 or 15 years ago I would say it was even common.
I'll address the religious first, because this one is way easier. For those of you who don't know, there's a very large segment (about 10%) of Israel that is highly religious [Jewish] and poorly integrated. They live in their own enclaves or cities, don't serve in the army, some oppose the existence of the Jewish state in the first place, they highly restrict television and newspapers and internet, etc. Employment is less than 50%; they mostly live off of the dole. They attend their own [publicly funded] schools which often don't teach any useful skills, dooming them to a life of "study" (air quotes because a lot of them don't, in fact, study much). The reason for this is political calculus, and short-sightedness. When the state was first established, allegedly some of the early leaders wanted to preserve this highly archaic way of life that had been almost completely destroyed, and so they gave money for a few tens of thousands of highly religious Jews to focus on studying the Talmud and Mishna and preserve that cultural heritage. The problem became that they reproduced very very quickly (when you're a subsistence farmer, you need as many children as possible, and passing through the Holocaust isn't going to change that opinion); while the numbers have been getting lower and lower, they're still almost 4 children per Haredi woman today, at were much, much higher in the past. They also became very, very politically organized, with almost all Haredim voting for one of two political parties (representing Sephardi and Ashkenazi Judaism, respectively, though the Sephardi party also receives support from some less religious Sephardim). This ensures that they have a lot of political clout, and since they're basically a one-issue party, they've been considered a "safe" choice and have been in many/most of the governments in Israel, protecting their rights to the dole and non-conscription.
This situation could have been easily avoided from the get-go by not letting their have their own schools, making it less easy for them to claim life-time dole payments, and forcing them to join the army (an important source of skills, common culture, and connections in Israeli society; historically, many jobs have required military service, though in fairness that's often just been a way to discriminate against Haredim and Arabs). The Haredim might or might not assimilate (I'm betting that they would, except for a few hard cores like the founders of Bnei Brak or Mea Shearim), but they would be much less poor...especially if their fertility rates drop as their prosperity increases. You can look and see Haredi populations in much of the world today, and only in Israel and the US are they so unemployed and poor - and in the US, that's fairly recent and takes heavy inspiration from Israel.
The 800lb gorilla in the room is, however, the Arabs. For most of Israeli history, the government's solution to "the Arab problem" has been to ignore it. Arabs lived in Arab towns, worked at Arab jobs, attended (very poorly funded) Arab schools, didn't join the Army, and socialized with and married other Arabs almost exclusively. The Israeli government heavily neglected Arab towns, often not running roads to them, allowing them to remain unconnected to the power grid and have no sewage systems, etc. Cholera remained a big problem in Arab towns in Israel through the 90s. Cholera. In an allegedly first world country.
Cholera.
Anyway, where there was Arab-Jewish interaction, it was often limited to small-scale commerce with neighbors, or use as relatively unskilled labor - construction work, agricultural work, etc - and even that only picked up in the 70s, as the poorest members of "mainstream" society were becoming too educated and expensive to do the same work. Now, there were a few places, like in Haifa, Yafo, Nazareth(ish), and Ma'alot-Tarshicha where Jews and Arabs lived in proximity, but even then their mostly went to different schools and worked and lived in parallel societies, Jews eating at Arab restaurants and Arabs shopping at Jewish shops being the "paragons of integration" - which is kind of sad, because compared to much of the country, this was in fact highly integrated.
Obviously, this lead to Arabs in Israel being much poorer than average, which they're only just now starting to get over.
There are a couple of solutions to this problem in Israeli history. The first, easiest, and most horrible option is simply to have fewer Arabs in the country. More expelled in 1948, or have later expulsions - through the 50s as a reaction to Fedayeen raids and fears of a Fifth Column, for example. Without touching on any of the other implications of this, it would certainly eliminate a poor segment from Israeli society.
The next step would be continued segregation, but more equality. Honestly, though, I'm not sure how this would happen; politicians are politicians and no one wants to spend a lot of money building infrastructure where there isn't any (especially installing sewer systems in pre-existing settlements) in a place where the residents almost certainly aren't going to vote for them.
Less unthinkable but more difficult is integration into Israeli society. This is difficult primarily because neither the Arabs nor the Jews want such a thing occurring, though steps were made. It's important to note that Arab society in Israel is far from monolithic. Christians are, on average, more urban, better educated, and richer than Muslims, and this was even more true in the past. The Druze (don't call an Israeli Druze an Arab to his face, by the way) have been joining the IDF and receiving token positions in major parties for almost the whole history of the country, and though they still mostly live in their own towns and marry their own, the army service causes them to be more integrated and less discriminated against. Circassians are similar, and Samaritans as well (again, don't call either of those groups Arabs, but they are a religious and ethnic minority that largely lives segregated from Israeli society, so if the shoe fits...)
The Israeli government also has a complicated relationship with the Bedouin of the country. Many join the IDF (though historically they served alongside the Druze in the IDF Minorities Battalion, a Jewish-officered unit in the best tradition of Sepoy regiments). There have also been several attempts to settle the Bedouin of the country, especially of the Negev, starting in the late 60s. These attempts were mostly an exciting combination of building brand new (often kinda shitty) cities in the desert, offering them essentially for free to local Bedouin, and demolishing all non-licensed settlements. In fairness, there was a fairly good attempt to work with tribal leadership in this process, and the transitions were often fairly peaceful. The towns had decent infrastructure and were connected to the country's road network, but unemployment remains very very high (even taking into account the informal economy), as does poverty.
The problem with trying to assimilate people more forcefully than OTL is that it quickly runs up against resistance from the people in question, who often want their own separate societies and never asked to be part of Israeli society or even a modern, industrial or post-industrial economy; most of the poorest Arabs were subsistence farmers before the establishment of the state. But more forceful attempts could be made. Forced integration of schools and busing. Requiring Arab participation in civil service if not the IDF (there are deep problems with forcing unwilling people to join a military that's fighting against some people they might identify with). Better infrastructure to Arab towns. The problem is that there's no political will for this.
On a positive note: in both Haredi and Arab societies, these trends are reversing. Both are enlisting more and more in the IDF (a decent proxy for "integration into society"). Programs to increase the number of Haredim and Arabs - especially Arab women - in the workplace are common and well-funded, both government and privately sponsored. Arab and Haredi schools are getting more money, and the former are getting curriculum reform; attempts are being made the reform the latter as well. Poverty is actually dropping pretty well in those sectors. Following further trends, the problem of severe poverty will probably be resolved in about a generation (the segments will remain poorer, but will largely no longer be in poverty).
Edit: just to add, Israel is hardly unique in having a large, segregated, poor population. Sami in Scandinavia, Native Americans/First Nations/Aborigines in thw US andCanada, Aborigines in Australia, groups throughout South America, Appalachian Hill Folk in the US, Roma in much if Europe, etc. Numerous different integration strategies have been tried, and I'm not sure any were much more effective than in Israel.