Automation is not a threat to demand in the sense that people won't stop demanding products because they are making them at home (as OP ridiculously claimed). Rather, automation will drastically change the economics on the supply side.
You're absolutely correct that unless managed well this could lead to mass poverty (and hence decreasing demand). I'm optimistic we will eventually find some solutions, either in the form of basic income or higher-order work.