They will sometimes choose the simple slow options, true. But there's a very trivial fix. I just regularly ask the AI to review the entire codebase for bugs, performance bottlenecks (it will happily profile your code), possible simplifications and YAGNIs. I get it to give me a ranked list and then I review that and ask it to do some of them.
Occasionally I do spot things and get a "you're right, I was wrong". But it's got to the point that my thought is no longer "of course I am... shitty slop machine" but "phew, I'm not totally obsolete quite yet!".