While the body doesn't need sugar to function, it also doesn't reject sugar like other substances. Humans have always consumed foods that are more pleasurable than nutritious. Sugar is an example of this type of food.
Much like chocolate, consuming sugar releases endorphins which makes people feel happy, which can then form a craving or habit.
As an ingredient, it's extremely versatile, not just having a place in desserts but also used in many different cuisines. For example, sugar is a common ingredient many regional cuisines, such as BBQ and even some Indian curry dishes, such as vindaloo.
Sugar enhances flavors, and while sugar can effect someone's health, a person diet is not entirely made up of sugary substances.
While taxing sugar would generate a large amount of money, it's unfair to tax it when it's considered a commodity. Unlike a sales tax which can charge food items cooked and made by a restaurant, sugar is a raw material that’s transformed into something else. To tax it when it’s in this form would influence prices in a cascade effect. Prices on everything that contains sugar will increase, not just sugar.