Consider a different case: Author writes some code for a kernel Org module. The code gets submitted into the git tree of a subsystem maintainer, but before it gets pushed to the main Linus tree, the Author decides it is not good and should be retracted.
Suppose someone else does like the code and steps up to maintain it (so it's not an issue of unmaintained code). In that case the code may still get included in Linus' tree. The credit for writing it will still go to the Author.