I'm not sure about this,however,there's another sugar called 饴 in China much earlier than 唐dynasty,but as you think the character 糖 did not exist in earlier China.
fiorenza said it is a character from 《说文解字》,it isn't correct,actually it is a character from 《广韵》 that was written in Song dynasty,说文解字 was written in Han dynasty which is earlier than Tang dynasty,all that we can know is the character has something to do with rice(米).
and I found that China is an original place of sugar production,so the character may related to Tang dynasty,but not the way you think:)