So recently I have been thinking a lot about this fundamental question: Does the Sonnenschein-Mantel-Debreu theorem disprove the "Law of Demand"?
It contradicts law of demand as a general law but it is worth noting that the law of demand is for over a century not considered actual general law but just a special case that is simply applicable to most cases. In fact this is nowadays plainly stated even in 101 economic textbooks (see Mankiw Principles of Economics 5th ed pp 471), which mentions that not all demand curves are downward sloping.
Economists were even aware of the Giffen goods (goods for which demand can be upward sloping) for over a century. In fact if Mises ever read Marshal's Principles of Economics (published in 1890) he would be aware of Giffen goods as well, and given popularity of Marshal's principles I don't think there was any economist living around that time who did not read it. This being said such goods are extremely rare but they can exist.
I was also told Steve Keen was a hack and that I shouldn't read his stuff.
Steve Keen was shown not to even understand basic high-school/bachelor level mathematics (see this criticism of Keen or this old SE answer as well).
He also often makes false claims about economics that are borderline lies (e.g. see this answer about his claims on Nordhaus work).
Even if you are into heterodox economics (i.e. economics most economists at top universities think is wrong), reading Keen is likely a waste of the time if you want to genuinely pursue the subject.
If you want to casually study economics I would recommend to take any 101 Econ textbook, to read just the text without going deep into oversimplified models that are there just for didactic reasons.
does the lack of a downward sloping demand curve mean that markets don't tend to produce socially optimal quantities?
Not by itself a market with upward sloping demand can still produce socially optimal quantity at socially optimal price. Also note downward sloping demand curve does not guarantee that quantity and price produced will be socially optimal either.
Whether quantity and price is socially optimal or not has little to do with shape of demand curve. It depends more broadly on whether markets are competitive, whether there are market failures such as externalities, public goods etc (see discussion of this in Mankiw Principles of Economics 5th ed pp 203-238). Furthermore, it depends on the choice of social welfare function, e.g. Rawlsian, utilitarian etc (see Mas-Colell et al Microeconomic theory pp 825).
I am personally not aware of any economist that would claim that downward shape of demand curve is what leads to market efficiency.
And does this undermine the ECP?
No this in itself does not. Economic calculation problem was never about whether markets are always efficient or optimal. Economic calculation problem was about problem of making economic calculation under socialism.
Market economy might not be 100% efficient, but that has no bearing on whether you can even do economic calculation under socialism or not. Mises and Hayek argument was that without genuine market prices it is impossible to make economic calculation.
The argument, at least the later developed version was not that market prices are sufficient for rational economic calculation, rather the argument was that prices are necessary for rational economic calculation (Hayek 1935). Moreover, Hayek even criticized the supply-demand equilibrium model to begin with (if I remember my University lectures on history of economic thought correctly he was in favor of agent based modeling).
For example, Hayek (1935) explicitly argued (emphasis mine):
Of course, these adjustments [to changes in market condition] are probably never “perfect” in the sense in which the economist conceives of them in his equilibrium analysis. But I fear that our theoretical habits of approaching the problem with the assumption of more or less perfect knowledge on the part of almost everyone has made us somewhat blind to the true function of the price mechanism and led us to apply rather misleading standards in judging its efficiency. The marvel is that in a case like that of a scarcity of one raw material, without an order being issued, without more than perhaps a handful of people knowing the cause, tens of thousands of people whose identity could not be ascertained by months of investigation, are made to use the material or its products more sparingly;
i.e., they move in the right direction. This is enough of a marvel even if, in a constantly changing world, not all will hit it off so perfectly that their profit rates will always be maintained at the same constant or “normal” level.
Professor Schumpeter is, I believe, also the original author of the myth that Pareto and Barone have “solved” the problem of socialist calculation. What they, and many others, did was merely to state the conditions which a rational allocation of resources would have to satisfy and to point out that these were essentially the same as the conditions of equilibrium of a competitive market. This is something altogether different from knowing how the allocation of resources satisfying these conditions can be found in practice. Pareto himself (from whom Barone has taken practically everything he has to say), far from claiming to have solved the practical problem, in fact explicitly denies that it can be solved without the help of the market.
But, if, as the SMD seems to indicate, demand curves can really be any shape, and supply curves don't have to be upwards sloping (as Keen illustrates) then we can effectively have multiple different equilibriums and there is no gurantee we reach the socially optimal one. That kinda fundamentally undermines the ECP no?
As already mentioned before Keen was shown not to understand basic calculus so I would not take any proof of his at a face value.
This being said there could be multiple equilibria in an economy even with all demands being downward sloping and all supplies upward sloping. Downward sloping demand and upward sloping supply does not guarantee existence of unique equilibria in complex general equilibrium models (see Wickens Macroeconomic theory).
This however does not contradict the problem of economic calculation, because problem of economic calculation is literally about problem of doing economic calculations under socialism (economic calculation problem gets its name from Mises' work Economic Calculation in the Socialist Commonwealth, the economic calculation here refers to that particular economic calculation not to economic calculation in any system, even thought the authors did often compare it to market economy). Sure you can apply the corollaries about price mechanism to argue in favor of market economies, and I am aware that both Mises and Hayek did that but it is not the main focus of an argument. Basically the problem of economic calculation boils down to asking how can one perform economic calculation under socialism, and Hayek and Mises answer was that it was impossible.
Furthermore, the problem of socialist calculation is about socialism not being able to produce the most efficient quantity, rather that rational economic decision making under socialism was not possible (although in a simple models rational economic decision making certainly leads to efficient outcome this is not universally true as discussed previously in this answer).
I put this here because you did not asked about but I think it is relevant.
If anything supply-demand analysis would be solution for the economic calculation problem. In fact as mentioned previously demand and supply analysis was argued to be one of the solution in the socialist calculation debate.
If there is some nice monotonic demand and supply that is fully known to a central planner then economic calculation is trivial. Just equate supply and demand calculate the optimum price and quantity and send commands to the comrades working in factories.
What even more, the more 'exotic' (i.e. not well behaved/defined) supply and demand is the harder it is to estimate what supply and demand is based on observable data. Hence if anything existence of multiple equilibria or some exotic demand or supply curve makes the problem of economic calculation under socialism even worse.