So Automation is a threat to both supply and demand...
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.
Most of the world will live in poverty (just like today) and a increasingly smaller group of humans will live in extreme luxury.
While idea's like UBI would be nice, the point to implement them I believe is past... They should have been created decades ago. If we wait until 20% or more of the jobs are replaced by automation, it will be to late for most people... Poverty will be the future... Poverty is the future for most.
It's just in the last few hundred years where we've actually moved people out of poverty that we've come to the idea that people shouldn't be in poverty. Before that, it was just assumed that everyone besides the rulers were in poverty. And if you read stories from the time, there's never any idea that it could change or that peasants could all be royalty.
Stories from pre-1500 that involve wealth are all generally about an extremely lucky peasant being married up to royalty, and that was pretty much the only way to move up from poverty. Well, that or war.