I feel like a lot of the issue is that software engineers used to be subsidized by both investors propping up unsustainable business models and extremely invasive targeted advertising, and both of those things are either phasing out or being legislated away. A lot of the tracking and advertising practices that kept services like Facebook and Gmail free are illegal now (rightfully so), and investors are starting to realize that not everything is going to become profitable just by having an app.
I think the solution is probably two fold. First, I think the government should invest more into open source software. A lot of the work that keeps the internet running is done by unpaid volunteers. And second, I think we need to go back to paying for services. Giving away services for free because you use them to spy on your users is just an unethical business model. It’s profitable, but so is child labor.