It's not unlike copying code from stack overflow and swapping the identifiers around.
It's certainly possible. Back when Phoenix reverse-engineered the IBM BIOS using published sources with a restrictive license, they did it by having one team read the sources and write a very detailed specification of everything that happens there, and then another team used that spec to write new code from scratch. They did it that way because if the first team were to write the code themselves, it is quite likely that the result would be legally considered derived work.
In that order likely a violation, but it depends on the concrete case, always.
I take care to attempt to not duplicate code; it's why don't use copilot.
Isn't this exactly what you'd expect an AI coder to do?
What is the specific difference?