Get rid of regular income tax, then do a progressive wealth tax, which is enough to pay for a progressive UBI. This way, it’s no problem if you lay off all your workers to replace them with robots. In fact that’s great! Because now these people have a UBI, which frees them up to go find (or make) other work. Meanwhile the factory owner’s taxes should be going up, since his wealth is going up since he doesn’t have to pay all the workers, unless he’s still spending that money to further invest in things, which is also great.
The biggest problem really is people just hoarding wealth. If they are spending or investing it, then that’s not a problem.