But works of non-fictional literature (of which source code is an example) have to work harder to justify their copyright.
Many of the snippets of code generated by copilot contain zero creative expression. They are just mechanical implementations of an algorithm.
You mentioned setting and plot. The source code equivalent is architecture. Copilot generated snippets are usually too short and too algorithmic to have their own architecture.
What makes a derivative work derivative is that it copies creative expressions from the parent work. If you edit them out, then it’s not a derivative work anymore.
The use is only helping developing the algorithm by adding more value to the product in improving extracting the creative expression.
Copilot is a loose/loose game for developers, regardless on which end they are.
Which is why even very short snippets of code have been an issue.
There is a concept in copyright law of derivative work which means simply editing Harry Potter isn’t enough to publish it without paying for the rights to do so. Even highly transformative fanficfion can run into this issue when much of the original work’s characters and setting remain.
Disney gets away with this stuff by copying public domain works, copilot and it’s users don’t have that defense.