The system will collapse on itself if most are jobless. You can't sell products if no one can afford them.
My biggest grip with UBI is it just redefines zero. The better solution would be to do away with capital entirely, have people democratically vote on what services they want, and then conscript if there aren't enough volunteers/robots/AI to provide those services. There seems to be this tendency to forget that labor is what matters, not capital. Capital is a means of exploiting labor, but if labor can be automated or democratically voted for than no one is exploited.
Second: UBI is a response to economic conditions, not a driver.
Once the machines can economically/productively outperform most of us, UBI is an alternative to just letting us starve in the street, or riot, or whatever.
The robots provide an economic cornucopia exactly by putting people out of work. Supply becomes effectively infinite but demand/purchasing power falls to zero (because everybody is out of work) so rescue the economy (and civilization) you just give people money.
The remaining farmers still need things like fertilizer, people who service machines, etc, and they still have to put in work themselves. In fact farmers are some of the hardest working people I know. But the trend is still true, there are less and less farmers who generate more and more output.
You definitely need some way to distribute those resources to farmers (and other industries) in a good fashion, and in history the market economy approach with pricing autonomy has proven to be the best way. So money will likely not go away in itself, but economy will be more about resources in the future than about work.
That being said, the economies of even the rich nations are still highly dependent on human output so it's still way too early to discuss about UBI, but if we should find ourselves in a situation where we have literally no use for the work output of large percentages of populations, then we really need to think about some way to distribute resources to them so that they don't starve/riot.
If you say that only millionaires should be able to live without working, then you should look at what makes that millionaire a millionaire: their 20 rental properties? worthless if nobody can afford them. Their 5 square kilometer fully automated farm? worthless if nobody can afford the food. Their 100 million investment into a big company? likely that company is also out of business if nobody buys from that company. Sure maybe yacht builders will continue to have a great time, but that's a fraction of the economy. A lot of current millionaires would be rendered quite poor in a non-UBI future, as a lot of wealth is generated from serving existing customers.