Well if AI can replace software engineers then it can probably obviate many other jobs as well, meaning there would have to be greater societal restructuring than just some out of work engineers finding new careers. If you are 30 and you're worried your job will be automated away before you retire (but before universal income), perhaps you should get a head start by learning new skills that are harder to automate.
I wonder what your alternate theory that fixes the unemployed 50 something factory worker is? Legislation that ensures job security? Pension? Severance?