In this case I feel like it's the opposite. If generative AI really succeeds, most software devs will be out of job, in which case profits from those investments could become useful. If it flops, then there's a greater chance devs will be still needed.
1. If you become unemployed because it "succeeds", then a diversified portfolio probably does well as other industries reap the benefits, and if you have to cover lost wages you're at least "selling high."
2. If you become unemployed because it "fails", then there's a crash/recession where everyone is spooked and you get screwed by being forced to "sell low" during the transition.
I suppose there's also the chance you're put out of a job by powerful AI, but the "winners" are all lesser companies you never invested in, so you lose both your job and investments.
If these things really become good enough to automate software engineering then it’s just a matter of time before they are used to automate all information work.
That would be such a radical societal transformation that I’m not sure we would come out of the other side even having a capitalist society.