...if most consumer-grade audio playback systems are not designed to
be flat or accurate, why is it considered practical to write, mix, or
master your music on "flat" monitors?
Because most consumer-grade audio playback systems are not flat or accurate...
The goal of a "flat" near-field studio monitor is to let you hear what is actually going on, while other systems can hide flaws and colour your work.
If your mix only sounds good on a studio monitor then you haven't finished. When you start to make note of how you want to adjust your mix after listening to it on a wide range of systems, and go back to adjust and then test that new mix, and so on, over time you'll learn your monitors and how the kind of mixes you want sound on them, making it easier to achieve the kind of mix you want1 the first time around2.
You can do this on a less-than-accurate system3, but you have to adjust for the system you're using. The less accurate it is the more you have to compensate for that while not being able to hear any flaws which that system hides. All this when you most need to hear how things actually sound.
- Mixing on an inaccurate system, which you know well, gives you the advantage of being able to use that knowledge, but gives you blind spots.
- Mixing on a "flat" and "accurate" system has the advantage of less/"no" blind spots, but you have to learn that system.
TL;DR: Studio monitors may take some getting used to, but they are more practical to mix on, because, in the long run, they can give you better results more easily.
Having said all that, let me throw a spanner in the works by reminding you that the Yamaha NS-10, which became the standard near-field studio monitor, was originally launched as a consumer-grade bookshelf speaker...
1. A really good mix/master is one which has the right compromises to sound good a wide range of systems, as you've noted, and in a sense that mix won't sound "as good" on the monitors because they have, you guessed it, a very flat sound.
2. You'll still listen to them on different speakers and systems, of course.
3. And the bottom line is you will, everyone does because studio montiors and rooms all have their own characteristics as detailed in the other questions you mentioned.