According to evolutionary psychological theories, perhaps.
First you must understand that evolution happens very slowly, so our brains are adapted for the lifestyle we lived about 10,000 year ago.
Sugars and carbs provide a lot of energy, so they taste good to us to give us the incentive to eat them when we come across them. Back then, this was a rare occurence.
However, in a modern lifestyle, they are not hard to come by, and so they are bad for us because they are bad in large amounts. They still taste good because back when we evolved a taste for them, they were rare foods and we couldn’t really overeat them.
If, back when we were evolving our tastes for various foods, brocolli was a rare food and was good for us in small amounts, it would probably taste good like chocolate.