If the developer who does the rewrite uses the original as a reference, it will be likely that enough of the structure will creep through that the project will be at legal risk.
If you give me a sequence of integers from 1 to 1000 (which is not a creative work and therefore not copyrightable), and I selectively delete some of the integers such that the differences between adjacent numbers contains a fun message in ASCII, and publish that sequence, the result is copyright because those particular deletions add a creative element.
But if I just deleted every alternate number in the sequence, that wouldn't be copyrightable because it's not creative. (Although you can imagine some scenario when doing so might be creative, it would need some reason why it was.)
Basically, if Dev B does a change that passes some threshold of creativity, then they have a claim. If they just go through and delete all the blank lines and reformat in a standard way, they probably don't.
In your example, I think it would depend on which 20 lines and whether they were trivial changes to figure out.
1. A commit to plainly remove the functionality (or lines of code)
2. A developer would rewrite the code with a set of variables they cannot use, but I suppose they'd also code without the original implementation as reference.
Each individual developer's implementation should be different enough that it would be easy to tell that it was independent crafted, although something like this hasn't been tested in court (at least to my knowledge!)