After reading the wikipedia article, it's apparent that your example does not really demonstrate comparative advantage. "In economics, comparative advantage refers to the ability of a party to produce a particular good or service at a lower marginal and opportunity cost over another. Even if one country is more efficient in the production of all goods (absolute advantage in all goods) than the other, both countries will still gain by trading with each other, as long as they have different relative efficiencies."
From a bit further down in the article, " In Portugal it is possible to produce both wine and cloth with less labor than it would take to produce the same quantities in England. However the relative costs of producing those two goods are different in the two countries. In England it is very hard to produce wine, and only moderately difficult to produce cloth. In Portugal both are easy to produce. Therefore while it is cheaper to produce cloth in Portugal than England, it is cheaper still for Portugal to produce excess wine, and trade that for English cloth. Conversely England benefits from this trade because its cost for producing cloth has not changed but it can now get wine at a lower price, closer to the cost of cloth. The conclusion drawn is that each country can gain by specializing in the good where it has comparative advantage, and trading that good for the other."
Which is true, but it does mean that most of the wine producers in England and most of the cloth producers in Portugal are going to be out of a job and will have to learn how to do something else.
In your example the factory has an absolute advantage over both the basket weaver and the cobbler, but neither of them has a comparative advantage over the factory. Thus they have no incentive to trade with the factory whatsoever. The cobbler and basket weaver can ignore the output of the factory and keep trading their goods back and forth. However if the factory drives down the price of baskets and shoes in relation to food and housing then they'll have a hard time paying their rent and feeding themselves.
If _everything_ is automated, well you just argued that in order to keep their relative advantage the cobbler and basket weaver need to trade with each other rather than the factory. Which means they need to do all their trading with other people who are not taking advantage of the automation. Instead of buying food from the automated food factory they need to trade their non-automated shoes and baskets to the non-automated farmer for non-automated food. So now there's an entire second class of people doing everything by hand and ignoring the automation.
Unless you're saying that the cobbler will be selling their shoes for 49.9% of the original, to undercut the price of the factory, while the basket weaver is selling their baskets for 49.9% of the original price, and the farmer is selling their food for 49.9% of the original price, etc. But that works out to pretty much the same thing, there's a large class of people selling stuff for 49.9% of the original price and buying stuff for 49.9% or 50% of the original price, and none of them are getting any advantage from the factory.
Either the factories drive down the prices of some things disproportionately, and the people who originally make those goods suffer unless they can find a new job, or they drive down the price of everything equally, in which case you end up with two classes of people, those who can get new, more valuable jobs, and those who keep trading the same old goods around at a fraction of the original cost.