each Contributor hereby grants to You a [forever lasting]
patent license to [do anything with] the Work
The key part being "the Work", which is the code (in source or binary form) that's covered by the Apache licence. A derivative work would be covered by this patent licence, but a clean-room re-implementation of a feature would not because you are no longer dealing with "the Work".