I just shot you an invite to the PenFM beta, because you hit it on the head. www.pen.fm is taking on that end-to-end publishing challenge, and then some. Having worked in epublishing for a few years now, I think I've finally come up with a way to automate the hell out of epublishing--and the results show up. At any point in writing in PenFM, you can click download and get your work formatted perfectly in epub, mobi, or pdf. Formatting improvements are coming rapidly, and mostly present already for mobi.
The biggest problem I've recognized with epublishing is that you have to get the formatting down perfectly, and usually that requires a lot of work by hand making sure your input HTML file is exactly as it should be. When you control how content is inputted to a platform, it's much easier to automate perfect-formatted rendering of that input HTML file, including TOC by inference.