>Intuitively, I would have thought that a second system (rewrite of the first) may be better due to lessons learned.
And at least in one case, it was: in a C database middleware product that I worked on, as the team leader. It did work earlier but had big issues of bugs, slowness, memory leaks, and maintainability. There were many reasons for that, including complete freshers put to work in it (a mistake). After me and a small new team took over, we improved it a lot and fixed all those issues. It went on to become a much more successful product, deployed somewhat widely within the company, for client projects ...
And at least in one case, it was: in a C database middleware product that I worked on, as the team leader. It did work earlier but had big issues of bugs, slowness, memory leaks, and maintainability. There were many reasons for that, including complete freshers put to work in it (a mistake). After me and a small new team took over, we improved it a lot and fixed all those issues. It went on to become a much more successful product, deployed somewhat widely within the company, for client projects ...