why? because I have a BS in engineering and I make 6 figures. My wife spent 5 years after college getting her phd in a hard science and she now makes less than half of what I do and has to work way harder.
Firstly, you seem to be really lucky because a lot of grad students basically spend their masters working on what their advisors want them to and being lab monkeys. Things change once you get to PhD sure but you have to grind out two years to get there.
Secondly, not all corporations are closed source. Many companies, especially tech-focused companies, have tons of open source initiatives. A lot of amazing tools come from industry. And it's not like all grad programs are havens of FOSS - there's an endless supply of papers and projects whose code is either a) non-existent or in the form of snippets or b) blocked by a paywall (to get to the article to see the snippets if they exist).
Additionally, you can choose what company you work for. If you want more autonomy or ownership, you can filter for that. I joined a company fresh out of undergrad and I was pushing product-changing code in a few weeks.
Most of all, the reason why everyone doesn't go to grad school is because not everyone can get into grad school. You are going to a top tier program at a well-regarded (and well-funded) university. That's probably why you are having such a positive experience. These positions are, by their definition, exclusive and available only to a very small percentage of coders. People rag on industry about gatekeeping (throwing resumes in the trash if they are from the wrong school) but it happens even moreso in academia. I've coded plenty of projects in my spare time, have created and implemented novel solutions, can talk intelligently about a wide range of topics and have spoken at conferences...but if my GRE / GPA scores are too low, then you're SOL for the most institutions. They'll still keep the $100 application fee of course.
Jeff Schmidt goes into great detail on this in his book, Disciplined Minds. I'd recommend everyone check it out.
Why would people ever choose to instead go write code for some corporation that will always be closed source, has to be be whatever your supervisor tells you, won't even be owned by you, and may never see the light of day for the first 4-5 years out of college? Grad school seems more fulfilling, interesting, better for portfolio development, and you just happen to get a PhD out of it than most entry level coding positions.