How did the hedgehog come to mean gather?
彙


2: 類; 4: 聚合

If 彙 in 辭彙 means '類' (type), the explanation would be: 辭彙 = word types
If 彙 in 辭彙 means '聚合' (gather), the explanation would be: 辭彙 = gathering of words

辭彙: 一種語言裡所有語詞和固定詞組等的總稱。除一般語詞外，還包括古語、方言、外來語詞及各科術語。 (A general term for all words and fixed phrases in a language. In addition to general words, it also includes archaic words, dialects, foreign words and terms of various subjects.)

My theory on how the meaning of 'gather' was extended from hedgehog:
When someone got shot by many arrows, it is commonly described as 被射成刺蝟一般 (be shot to look like a hedgehog). Similar to pin cushion gathering pins
We can compare a pin cushion to an empty field and compare the pins as words and particles. A language is like a pin cushion gathered many 'pins' -- like quills gathering on a hedgehog's back
Since '匯' and '彙' sound the same and both contain the meaning of 'gather',  辭匯 had become an accepted variant of 辭彙 in modern Chinese.