I don't think inequality is necessary for an economy to function but it may depend on what you mean by inequality. Primitive societies and their economies survived for a very long time and some are still going, with everyone being virtually equal. Mentioning a hypothetical situation where everyone is a millionaire is not helping anything, although they would for sure be equal. But the price of bread is surely going to go up and someone is still going to have to bake it (see thread on baking bread). The point is, you have to make a living and if you're going to have the things you can't produce yourself because the raw materials are absent where you happen to be, or you lack skill at doing something or you're too busy producing things you can produce yourself, then you have to trade for them. And to trade, you have to have something to trade with, generally the surplus of the things you do produce beyond what you actually consume. This ignores any higher social organization like complicated tribal structures, kingdoms, principalities or other forms of intentional communities. And most of this sort of thing requires community. A trapper in the North Woods still depends on community for that is where his market lies.
Also, you have to ascribe higher notions of humanity to people than seems to be recognized here. Even now, people are frequently doing totally illogical things which help complete strangers, sometimes even of lower social rank and who are unfashonably dressed. People really do that even if you wouldn't. I realize there are people who won't give you the time of day but I think we have less to fear from other people than is recognized, even though to think that way is bad for the survivalist industry.