The forefront of sugar in baking is its added sweetness. This flavor is often associated with comfort, happiness, joy, and a release of dopamine in the brain.
Sugar acts as a counterbalance to gluten-forming proteins. As an ingredient that bonds with water, sugar pulls moisture away from other starches and proteins.