I don’t find it baffling at all and both your experiences perfectly match mine.
Asking AI to solve a problem for you is hugely non-linear. Sometimes I win the AI lottery and its output is a reasonable representation of what I want. But mostly I loose the AI lottery and I get something that is hopeless. Now I have a conundrum.
Do I continue to futz with the prompt and hope if I wiggle the input then maybe I get a better output, or have I hit a limit and AI will never solve this problem? And because of the non linear nature I just never know. So these days I basically throw one dart. If it hits, great. If I miss I give up and do it the old fashioned way.
My work is in c++ primarily on what is basically fancy algorithms on graphs. If it matters.