A large part of this is that writing a book is easy.

Writing a good book is hard.

Writing a good book and getting it packaged well is harder.

Writing a good book and getting it packaged well and marketed well is really high effort.

I've published a novel. It's part of a series (#2 is being proof-read; link in my profile). Of the time I've spent on this project, writing is the smallest. I've found I can churn out ~20k words a week if I put my mind to it, so a 60k-80k novel is doable in a month. But then it needs to go through an editor (and you need to spend money on a decent one), and a proofreader, and a cover designer (no, unless you're an artist with some design flair your self-designed cover will rarely cut it for fiction), and then you need to market it, including putting in high effort into getting people to review it (but caution: soliciting reviews is a minefield - Amazon does allow you to offer a free copy, but you must be careful not to influence the reviews).

All that, and you still will very likely not sell very much at first (irrespective of quality; and of course part of the challenge with self-publishing is that there's a lot of self-delusion about writing quality going on). Charlie Stross mentioned on Twitter a while back that it took many years (10?) before he made more than 5k/year from his writing. That was with building up a back catalog.

So if you want to write for money, you need to decide whether you see this as buying a lottery ticket (write and submit to traditional publishers and hope you have the next Harry Potter etc.), or if you're ok with being paid per word (submit queries to magazines).

Or if you want the long, hard slog to build up a back catalogue and fan base. People do manage to build serious income streams that way even with small sales per book, but it takes time and a focus on writing fast and churning out as many books as you can. My favourite example is Kjell Hallbing, who under the pseudonym Louis Masterson wrote 100+ western pulp books - the most well known is Morgan Kane (the books were released from the 60's onwards; warning: the originals are very pulpy and dated to start with, but the recent English translations are apparently particularly bad).

He sold ~20 million plus during his lifetime - an astonishing number for a Norwegian author (given the Norwegian market is only 5m).

The key was the number of books, and getting translated to 20+ languages, and time. On average each book only sold about 10k per language - some more, some less, of course - over a period of decades. But write enough and sell it over many enough years in many enough markets that are not as saturated, and it adds up.

(Or maybe you don't really care about the money, in which case you can do exactly as you please.)

For my part, the writing is a hobby. If it starts to accumulate income over time, then it'll be a great bonus. I'm writing pulp-y, short sci-fi novels in part because I like reading that, in part because it's easy to write as a part-time/hobby project compared to some 250k word monstrous volume.

The TL;DR is that writing a book is a really great idea if you like writing, but if you do it because you want to make money, you need to realise from the start that the writing will be a relatively small part (doubly so if you're planning to self-publish), and that short of figuratively winning the lottery you'll need to write a lot of a long period of time for it to start paying off. If you want a get-rich-quick scheme, writing books is probably a bad idea.