Spears cheaper to manufacture; I can't supply a reference (there are a few smiths in H:SE and I wonder if they can provide information) but a good smith can crank out spearheads quickly, and attach them to bamboo poles. Techniques for fighting in spear can be taught to formations of peasants quickly and easily. (and green troops derive quite a bit of courage from being in formation). Spears require relatively little metal, cheap wood, and green troops. You can replace a spearhead (and the troops to wield the spear) quickly.
@Greg correctly points out that I should use the term tachi below rather than katana; he is correct. OP used katana and I have used katana other than to acknowledge @Greg's point.
Katana however is an expensive weapon. There are ample references (include a good one on youtube) about the skill, time, and quality of steel required to manufacture a katana. Green troops cannot master a sword; I've been working on sword techniques for years and I am still unable to reliably demonstrate basic skills. Much of the reason for the mystique of the katana is that they were so expensive to make that it wasn't worth making junk katana. If you're going to spend that much money & time, you're going to make everyone as close to perfect as possible. If your weapon costs that much, you're only going to put it in the hands of a very skilled and very well trained warrior.
@Greg argues that I overestimate the cost of the katana; perhaps. I would welcome anyone who can provide better costs. With due respect to Greg, I believe that a katana is going to be a multiple of the price of a spearhead. @Greg also argues that I overestimate the skill of the warrior; I believe we actually agree on this point, but that I've expressed the concept poorly. A samurai is a professional warrior; they are expected to train at a professional level. Formation spear work is for militia troops who are not professional warriors.
(Aside: the Chinese have a relevant proverb - you can give a man a Dao and have a soldier in a 100 days; give a man a jian and it will take one thousand days. Granted a Dao is not a spear, but the theory is the same. You can train foot soldiers in simple cut/thrust/parry formation fighting quickly. You train such troops with weapons that are cheap to produce and effective in the hands of people with limited experience.)
(Second aside: I don't have a reference, but my recollection is that a handful of samurai took out entire formations of shinobi troops in a single day. A handful of men victorious against an entire army, because the quality of troops and weapons were totally different.)
Cavalry is a different problem; I sincerely doubt you'll find peasant troops in a cavalry formation. Cavalry requires extensive training for both horse and rider. Cavalry should be a very expensive troop. I'm not familiar with cavalry tactics at all, and the limited contacts I have in the cavalry world are western cavalry, not Asian cavalry. I freely admit that I'm not competent to discuss the different cavalry tactics with spear, lance, guan dao, etc. I am very dubious that anyone could use an 18kg guan dao from horseback. But as discussed in the comments, I am skeptical that Guan Yu actually used the Green Dragon Crescent; I think this is a signature endowment to assist with storytelling.
I don't have my book present at the time, but Scott Rodell relates that Chinese warfare was shaped by a different dynamic. The Chinese were able to muster enough low skilled/cheaply armed troops to dominate the battlefield. Japanese warfare was shaped by more elite fighters and less mass formations. There are Chinese swordsmen with astonishing skills and wonderful blades, but they had less influence on the battlefield. The battlefield was dominated by skill as a General, not as a swordsman (because raising mass levies were cheap). (Errors are mine, not those of Laoish Rodell.)