I fix it by micromanaging it. Which class, method, function, module - I dictate the low level structure and features. I dump my all my hard earned coding opinions in a profoundly crafted markdown file.
What helps me adjust is what I call Thanos-coding: trying to get AI to do the thing with contexts and agents and SDD and whateverthefuck, and if it gets tangled on its own shoelace say "Fine. I'll do it myself." Alternatively: making its mistakes disappear with a snap of my fingers and starting over.