I know people many people who learnt to code in their own time for ~6 months and landed a decent first job. Over the next couple of years they learnt a lot more and now have great jobs earning within 20% of what a doctor usually earns however they don't have the debt and saved a few years of their lives as well.
Not saying everyone can do this and become a software developer but it is very possible. I don't have a degree, I had to leave school at 16 (I am now 32) and worked in a shop to get by. I self-taught and now I earn a few £ under £100k making software. I have a super comfy life. I have zero debt (well a mortgage but no other debt), a nice house, family, a fair amount in savings, etc. Honestly I couldn't ask for more especially considering the rather small investment I put into getting this lifestyle.
But many many software engineers do. Many of us go to uni and study a traditional degree and therefore, have a lot of loans etc as well as spend 3 to 4 years in University.
Also, learning for a software engineer is pretty much forever since the moment you stop learning is your downfall in software development.