Does sugar turn sour after prolonged cooking?
No, sugar will never turn sour after long cooking, no matter how long you cook it. This must be some myth. 

If you take your sugar beyond caramel and into a burned stage, it can become acrid with a faintly sour taste. But this cannot happen as long as there is any moisture in your food. The whole content of the pot will have to be a single black lump of charcoal before this occurs. It is not possible for the dissolved sugar in the soup to burn to this stage. 

Peter Taylor's suggestion is interesting. In any fermentation process, sugar will be turned into acid. But cooking temperatures are way too high for a fermentation. You'd have to keep the food for hours below 45 Celsius to sustain a bacterial or yeast colony; it would flourish at even lower temperatures, around 37 Celsius, giving you obvious fermentation effects. This is a temperature which many people would find not hot enough for a bathtub, less alone to cook a soup. If the myth was born from this effect, it must come from a tradition in which the beans were soaked in warm water for hours, then cooked for a shorter time at higher temperatures, instead of being cooked all the time. 

There are other ingredients which should be added at the end, for example fresh herbs. They are likely to lose their flavor, not turn sour or something else. But this doesn't apply to sugar, which has no aroma to speak of. 

Sugar also doesn't get inverted by cooking. It stays as a single molecule (sucrose) until it starts reacting into more exotic stuff, undergoing complicated irreversible chemical reactions and turning into caramel. Inverting the sugar (= breaking it into glucose and fructose) is possible, but cannot be done by temperature, it needs acid or seeding. Even if you were to invert some sugar with acid, it would 1) happen almost instantly, and 2) any sour taste will be due to the acid you used. Glucose and fructose are both sweet and not sour at all. So, if your sugar is getting inverted in the soup (which will happen if you are already using other sour ingredients - but I can't imagine why you'd do it if you want to avoid a sour taste) it is not making it sour. 

So, I can't know what associations created this sugar-turns-sour myth, but it isn't true.