score:21
Tofu's origins are not conclusively known. The leading theory, however, is that it was invented during the Western Han Dynasty by Liu An, the king of Huai Nan. The earliest known reference to this is made in the Shiyi (a type of history book that is sort of an unofficial addendum to the official histories) written by a Liang Dynasty official, Xie Chuo (502-557).
《梁‧謝綽‧拾遺》 豆腐之術,三代前後未聞,此物至漢淮南王始傳其術於世。
Tofu creation is unheard of during the Three Dynasties (Hsia / Xia, Shang, Chou / Zhou). The making of this foodstuff became known to the world from the time of Han's Huai Nan King.
This is the most popular view in historical Chinese literature, including the authoritative Compendium of Materia Medica by Li Shih-Chen, (1518-1593)
《明·李時珍·本草綱目》:豆腐之法,始於漢淮南王劉安。凡黑豆、黃豆及白豆、泥豆、豌豆、綠豆之類皆可為之。造法︰水浸搗碎,濾去滓,煎成,以鹽鹵汁或山礬汁、或酸漿醋澱,就釜收之。又有入缸內,以石膏末收者。大抵得苦、咸、酸、辛之物,皆可收斂耳。其面上凝結者,揭取晾干,名豆腐皮。
The recipe for tofu began with the Han Huai Nan King Liu An. Black beans, soy beans, white beans, peanuts, snow peas, green beans and the like can be used. (...)
The evidence cited by wikipedia is a stone wall mural discovered in a Han dynasty tomb, which purportedly depicts the manufacturing process of tofu.
There is no true evidence of why or how tofu was invented. However a common tale is that the inventor's parents were old and unable to chew on soy beans properly. The inventor thus milled the beans into liquid, adding some medicine (plaster) into the mix, and inadvertently created a soft solid.
Another theory is that Liu An's monks came up with the idea, which if true would make it specifically invented for vegetarianism. There's no real evidence for this however.
The Wilkinson passage is probably sourced from the mention of Tofu in Qing Yi Lu, a miscellaneous book by Tao Ku (A.D. 903-970). While more accurately dating to the Five Dynasties (907-979), it is conventionally assigned to the corpus of Song Dynasty (960-1279) literature.
《宋‧陶穀‧清異錄‧官志門》 時戢為青陽丞,潔己勤民。肉味不給,日市豆腐數箇。邑人呼豆腐為小宰羊。
When Ji was the county official, he was honest and hardworking. He didn't eat meat, but bought several blocks of tofu each day. The city folks called tofu "the official's lamb".
Tofu was definitely known as an alternative to meat. Whether it was invented for vegetarianism is a lot more doubtful though. Meat was somewhat of a modest luxury anyway, so having a meat alternative doesn't necessarily say anything about being a vegetarian.