I've always heard about this possibility but I wonder how one would rewrite code, should the need arise. Wouldn't it be hard to do without effectively making a derivative work?
Suppose that you remove the code, reimplement it but end up with something that's extremely similar to the original (which is very likely since after all you're doing the same thing). Couldn't the original author argue that it's still their code? How do you prove that you did the work and just happened with the same code because that's just the most straightforward way to do it?
It seems like the only way to avoid the problem altogether would be to have some sort of clean room design:
- Dev A reads the code to be removed, writes a spec for the functionality.
- Dev A removes the code.
- Dev B takes the truncated code and the spec and implements the feature.
But that seems very painful to do cleanly, in particular one could argue that B should be a third party who is not intimately familiar with the codebase, otherwise it could be argued that they knew the previous code.