Sugar, fat and salt taste good. That means that humans and animals evolved to seek them out. If they were unequivocally bad for us, we would have evolved to find them disgusting.
If you are burning 5000 calories a day hunting or farming, eat all the sugar and fat you want (and can get by your own efforts). But if you are burning 2000 calories a day sitting at a desk... You can't debate food in a vacuum without considering lifestyle.