Get any kind of degree. A research degree is better. Not because people will ask you for your degree but because the effort of getting one teaches you how to learn new stuff. Especially a Ph D. degree. A few years into your career, you will have learned most of what you know on the job.
I know plenty of programmers with degrees other than computer science. Geologists, biochemists, theoretical physicists, etc. Most hard sciences involve some degree of programming at this point (usually Python). And with AI, system thinking is becoming much more relevant than deep algorithmic knowledge or math skills. Nice if you can do that stuff manually but not that essential anymore.
A difficult degree in philosophy or english lit also does the same thing. Humans are amazing generalists, and when we practice thinking deeply, that skill transfers and allows us to pickup new domains.