To me it sounds like what's described is similar to my own interactions with ChatGPT where:
1. Write a prompt, get a full script in response (good! as I expected)
2. Realize something missing in the prompt, or want to improve a specific function.
3. Prompt like "For function foo_bar(), give me just a updated version of that function that adds exception handling for missing files".
4. Chat GPT ignores the (admittedly implied in my language above) "just that function" part, and rewrites the entire script.
While usually it only modifies the part of the script I asked it to, it's annoying because (1) it's slower to give me the whole thing back (2) need to do additional checks in case the function I care about depends on things outside of it that might have been changed.
I've had this a few times, so I'm in the habit of not trying to iterate with chatGPT when asking it for scripts, but instead just doing the rest myself.
(Disclaimers: I haven't tried too hard to find a solution to this; there might be one; I also don't generally combine ChatGPT with Copilot; one or the other on different projects; and haven't tried other forms of using GPT-4...)