And it is difficult to identify the motivation behind every piece of legislation but the Roosevelt administration, Beveridge, LBJ and others often acted with the clear intent of creating greater equality. And, as I think you point out, did things that would have been impossible before the wars.
The huge reduction in the XXth century was due to many factors.
You start in the XIXth century with the development of Anarchism, which, to oversimplify, spawned various movements such as democratic socialism or communism on the political side, but also syndicalism (anarcho-syndicalism). The appearance of these forces started to change/influence things even before WWI with a few laws regulating working conditions (ex: 6 days week in 1906 in France voted after the Courrières mine disaster, or in Germany with a basic form of social security put in place in the 1880ies).
The two World Wars, and specially the various states (France, UK, Germany Russia) defaulting on their debts (either through inflation or complete un-acknowledgment of the debt) basically killed the rentiers (previously it was really nice for them, 5%, with an economic growth of 1 to 2% and practically not inflation).
The rise of the legitimacy of the State also helped a lot. This is due to the rise of Nationalism, the efforts of various states to build a common identity, and also the technological developments which permitted for a state to reach every corner of its population (transport and communication). This lead to the legitimacy of states to raise taxes which would have caused revolts previously.
WWI and specially WWII also shifted mentalities hugely, it's quite interesting that countries either monetarily or literally in ruins created Social Security systems.
Lastly the degree of technological development and its progressive deployment between 1820 and 1980 (in Europe and North America) hugely improved material condition for most people. The equation is a bit different when you are past 80% of the economy being subsistence farming.
Yes, some past events did change wealth distribution (the Plague for example), but a change on that scale is not something ever seen before in History, the XXth was pretty exceptional in that regard.
The war “helped” only in the sense that it often acted as a selection for the political classes in the following 20 years or so, in some cases literally (Italy and France).
Socialism was not that strong before WW I destroyed the power structures of the German, Russian, Austro-Hungarian, and Ottoman Empires. The resumption of war in World War II destroyed the Japanese and Chinese Empires and enervated the British and French sufficiently that the British and French Empires dissolved after the war.
They were rather explicitly a response to the conditions of the lower classes in a capitalist (in the relatively pure sense that was dominant before the rise of the modern mixed economy through the policies under discussion) economy.
I don't believe that the purpose of mid-20th-century laws was to promote equality. Things were more equal then because: a) World Wars I & II destroyed huge amounts of capital, and b) fighting wars requires lots of money which requires raising taxes on people who can pay, since borrowing cannot fully fund general wars.
Economics are cyclical in the sense that in normal times people with power and wealth accumulate more power and wealth. Then a general period of war/revolution/epidemic/famine breaks out which disrupts power relationships and consumes wealth. This is the pattern in Europe since the 1300s and it also applies to dynastic changes in other societies, such as China.