I can confirm this is exactly how llms are working.
Spent two hours trying to get an llm to implement a filescan skip a specific directory.
Tried, claude code, Gemini and cursor. All agents debugged and wrote code that just doesn't make sense.
Llms are really good at template tasks, writing tests, boilerplate etc. But, Most times I'm not doing implement this button. I'm doing there's a logic mismatch in my expectation