It is popular to say, "write what you love", "don't short-sell your art" and "money won't buy happiness", and... yeah, money might not be the most important thing in the world.
Until, you know, it is.
Because money might not make you happy, but lack of it can surely make you extremely miserable. Money might not buy health, but it will sure buy good health insurance; money won't buy love, but the day-to-day battle for financial survival saps out energy and joy of life.
As someone who has been through major financial straits with my family, I can definitely tell you that, hypothetically, if someone offered me lifelong financial competence (paid off house, new car every few years, college savings for all the kids) under the condition that I won't write another word ever again, I'd accept in a heartbeat.
No such cheeky little fairy is likely to come my way, however, so I'm free to go on writing while I try to figure out how to also make a living of it and have balanced family time.
I came to writing as a career from a point of financial crisis and major strain, which is probably not the best place to start with, as you do preferably want some funds you would invest in your books, like in any other business, but it did help me focus.
One of the reasons why I'm not no longer looking for an agent is that, even if someone could guarantee that I will land a good one, I can't afford the long-term haul of chasing a book deal. I'm not interested in literary recognition or winning contests for its own sake, either. Please give me the money, preferably soon so I can pay the electric bill.
That's also why, after casting my net far and wide with several genres I love, I am currently focusing on my Frozen World Antarctic sci-fi series, which is garnering me the best and steadiest reader response I have ever experienced. More established authors would probably see this as small potatoes, but for me it really is a cause for celebration when I get unsolicited sales and reviews.
Some authors are laboring under the misconception that "writing to market" means picking up the most popular genre of the moment and starting to work in that genre even if you absolutely hate it. Actually, writing to market means picking the one genre of those YOU love which is doing best commercially, and focusing on it.
This makes sense on more levels than just money. We writers, the cultural heirs of those storytellers gathering an eager audience around the cave fire, don't create in a vacuum. We thrive on the love, interest and engagement of our readers, and can only keep so long at something no one seems to want to read.
This doesn't mean that you should lower your standards with the reasoning of, "fans of the genre will swallow anything". Nor do you have to follow tropes, as is explained in this excellent post: "Formula writing means that by chapter two this has to happen and by the midpoint this other thing has to happen. Or, there has to be a rival for the heroine’s affections, or the dreaded misunderstanding. There are perhaps writers who write to formula, but that isn’t what’s meant by writing to market."