Cooking causes certain chemical reactions within the food being cooked, many of which produce (and consume) compounds which have various flavours.
I don't know the real specifics, but I can outline why your two cases are different, and you can verify it visually. If you take a potato, cut it up and boil it, it stays pale. The texture changes to become much nicer to eat, and the flavour loses that raw starchiness that raw potato has (ever eaten raw potato? I don't recommend it...)
If you take that same potato (or, for realism's sake, a very similar potato) and cut it up and put it on a baking tray and put it in the oven to roast, what you get out has golden brown edges and a different texture, and a bit of a skin over the surface. Why? Ovens apply heat differently. Inside your oven is air at 200 degrees C or so. This is much hotter than the water in a saucepan (which caps out at 100C at sea level unless it's a pressure cooker). So the first potential difference is temperature - some reactions simply do not happen at the temperature you can achieve while boiling.
The second difference is the environment. If a reaction relies on one of the gases in the atmosphere to happen (chances are it's oxygen), this is not going to be the same when the food's submerged in water containing far less oxygen than the air does.
So when you roast your squash in the oven, you're allowing reactions to happen which cannot happen if you boil it, thus leading to different flavours. Particularly relevant is the Maillard reaction, which requires a kind of fat and sugar and lots and lots of heat, and happens when you brown meat in the frying pan, or in onions being roasted in a hot oven. It's a complicated business that has many different possible end products, some of which can then react further to make different ones again... read about it on Wikipedia if you're interested in the details. The point is that there is no way to get those flavour compounds at temperatures too low for the reaction to happen - Maillard requires about 155C, well over the boiling point of water at sea level. There's also caramelisation, which is a different flavour-producing reaction.
I guarantee that if you make two batches of soup, boiling one and roasting the other, you'll find that the roasted one tastes quite different. That doesn't mean you can't make nice soup by boiling raw vegetables (I've done it), but you can't make the same soup.