it doesn't need to understand the way a human might do the understanding.
The pattern that the LLM managed to extract could include the structure, rather than the pure text. And in reproducing the structure, the LLM can replace the variable names but keep the structure intact.
I am not sure if copilot is able to do this, but chatGPT was somewhat able to (if imperfectly at the moment).