Someone smashed a bug with a piece of cloth they were holding. The bug guts left a stain on the cloth that did not wash out easily. Since the color was kind of pretty they looked for more bugs, mashed them together and started dropping their yarn and cloth in the resulting goo. After a couple of weeks the bug guts stopped producing the pretty color. Probably still dyed the cloth a color but not the pretty one. So they mostly stopped doing it. Mostly. Because undoubtedly someone was curious enough to keep trying different things and also different bugs. And then 11 months later the pretty color started showing up again.
What blows my mind is pine pitch. Sure you can get the sticky sap from the trees but who came up with the idea that if you put it in an egg shell and sealed it and put the shell over the coals for a while you got something much better?
There is not a logical series of steps I can think of that leads to that.
Heat the sap to make it more gooy? Sure. But the eggshell bit?
“The insect produces carminic acid that deters predation by other insects. Carminic acid, typically 17–24% of dried insects’ weight, can be extracted from the body and eggs”
Rather ironic that the bugs make carmine acid to deter predators, but they get squished by man anyway.