The real purpose of university education is to learn, not to get credentials, and an engineering degree provides rigorous problem-solving skills that are immensely valuable for programming, even if you never work in engineering.
Tim Sweeney argues that the true value of education is learning, not credentials. His mechanical engineering degree taught him math and rigorous problem-solving that proved essential when building Unreal Engine's 3D math systems, even though he never worked as an engineer.
transcript
Tim Sweeney: If you learn any engineering discipline, you learn massive amounts of math and you learn the rigor of problem solving, not just what you find from the Wikipedia article, but going through all of the exercises of solving complex problems and building up series of solutions to derive an answer, it's valuable and it embodies the knowledge that you need as a programmer. And people often go to the university and think, okay, my goal here is to get good grades so I get a diploma and I prove to an employer that I'm valuable. No, that's just kind of the superficial bookkeeping of the university. The real purpose of all of this is to learn. And whether you learn formally or you learn on your own, it's the learnings that are really valuable in a career.