When we say "sugar is bad" we refer to the 'simple sugars' found in ultraprocessed foods, not the slow absorption ones.
https://www.youtube.com/watch?v=dBnniua6-oM
A brilliant lecture by Robert H. Lustig, MD, UCSF Professor of Pediatrics in the Division of Endocrinology. He knows his stuff. :)