I wonder if the reverse has happened. Where a client pays for a project, and gets code, but it's terrible. So, open source it with attribution to the original developer and an appropriate README analysis of the low points. Edit: Wondering if it has happened doesn't mean I'm promoting it as a terrific idea.
I think most small-end jobs end up going to shit for more reasons than bad code, I'm still trying to understand the whole dynamic of how it all goes to crap.
I'd also just like to add if your hypothetical was the case would said developer ever care? I doubt it, they'd just move on to the next sucker.