I have a lot of years of professional experience in coding and I know very well what it means to take over an old code made by others. You come very soon to the point that it is faster to write new code than to change the old one. But for that you really have to be able to understand the current code functionality.
On the other hand if I look at the versions and changes of Sonar in the last couple of years, I suppose that they have already replaced a lot of the old code. I doubt that otherwise it had been possible to have such a stable Sonar X3. I looked at a lot of other DAW's too and I found that Sonar is quite stable and fast compared to them (a couple of forum comments from users of other DAWs confirmed that!). Also the design of Sonar is in some areas much more straightforward compared to competitors.
I think the reason that Cakewalk failed was mostly a management failure. I have seen such problems in my career too, that good software died just because of wrong decisions and monkey business in the top.
The only aspects of Sonar itself that were a little bit of a problem are that it is more complex than others (caused by more versatility) and it takes a lot of know-how to use it efficiently. So it was crucial to support a simplified usage for beginners with a lot of help and tutorials. And it was visible that Cakewalk had understood that in the last year, but this was too late. Another point that was visible from outside was the fact that they dissipated their energies in too many areas, instead of finishing one thing after the other. They wasted a lot of energy in collaboration with other companies (plugins, hardware, sample libraries, ...). They tried to satisfy all kind of users at the same time (musicians, studios, composers, hobbyists, rock music production, elektro dance music production, ...), this was too much!