Centuries ago, they made medicine taste like candy so fussy people would take it. There's a song about it, so I know this is fact.
Over the millennia, the flavors of candies changed—I'm going to assume so they wouldn't taste like medicine which, again, changed to taste like candy.
This is what Darwin meant by evolution and why religious fundamentalists crucified him on Dec. 25th, 1999. That's the real reason why we hang candy canes on Christmas trees and why they taste like toothpaste.