The reason it goes down a “really bad path” is that it’s basically glorified autocomplete. It doesn’t know anything.
Not quite true - GitHub Copilot in VS for example can be given access to your entire repo/project/etc and it then "knows" how things tie together and work together, so it can get more context for its suggestions and created code.
They're also bad at that though, because if you don't know that stuff then you don't know if what it's telling you is right or wrong.