> I don't know if a union would make sense for writers
Writers have unions, and quite a few of them (remember the Hollywood strike?). Some work, some don't; but generally speaking, they did improve compensation and arrangements for the profession.
The problems of the writing world are well documented, and mostly common to other creative fields: oversupply, intrinsic difficulty in quality judgement, and output that can be hard to monetise. I honestly don't understand why they were dropped with janitors, which have a completely different set of problems (mostly related to social status).
That is indeed a small part of it. Much more is that anyone who can graduate primary school can probably do an acceptable job as a janitor while the capacity to do programming just isn't as common. Supply and Demand, baby.
Because unions are bad and the Free Market will magically fix everything with its magical, invisible hand. Haven't you heard?
(though I don't know if a union would make sense for writers in general.)