Whole Foods was a standalone viable business with high-quality retail locations. Sears was neither.
But I'll certainly grant you that with the resources, a fantastic new model, and lots of luck, there were better outcomes possible. Not sure about likely.
As for the free market failure, I do think Sears was out competed, by a wide margin. By Target, Best Buy, Amazon, Home Depot, etc. New (ish), smarter, more nimble retail without the lethargy that had been inside Sears since the 1990s at least.
I agree that there's something wrong with the fact that management can do right by shareholders but simultaneously wrong by consumers. I don't know if I'd call that a free market failure though. Some kind of corporate governance discontinuity perhaps?
But the "market" as I think of it is strictly the retail consumer market, so when Sears failed the consumers, they were removing themselves from the retail gene pool. It would not be healthy for the market for them to continue operating.