Just adding onto that,
I think what you said will make obvious sense to coders, but a non-coder might wonder:
"well, why do I need to care how much spaghetti code is in my product, it seems to work and sound fine when I use it. AI code works great".
^ Because they don't know the future implications of hidden architectural debt.
One example, is how certain optimizations can lock you into a position where you can't add certain features down the line without making the program super CPU heavy (your simplified example was trying to illustrate this point, that some optimizations require future knowledge of features).
And so just using vibecode and prompting "make it efficient" will probably fill your code with all kinds of these ticking bombs: optimizations that work on assumptions that your product will stay how it is.
Then you suddenly get a feature request from a customer to add a certain feature, tell the AI to implement it, and your whole plugin slows down, uses tons of CPU suddenly because the optimizations no longer work for this feature set, so now instead of just adding the feature, you also need to get the AI to rewrite all of your framework. And if this is a big product, well, you're going to be sitting there for quite a long time waiting for that AI to rewrite and research everything again and build the product from scratch.
Someone might read that and conclude:
"In the end, if you keep throwing money at an AI, and keep running tests continuously, it will probably discover a lot of those cases in the end. So although AI is worse than a human coder, you can just let it infinitely rewrite the code from scratch, learning from the issues that arose from the previous attempt, and you'd get something pretty good eventually, even if you don't know anything about coding yourself."
I've seen this form of argument, and I think it's true.
But you're going to waste an awful lot of time, and with how dumb AI can be (still), you might as well just learn the theory behind how writing stable and fast software works, and then you can direct the AI to do things correctly the first time, because you know the stable way to write the program already and save a lot of time and confusion... wait...
✨ Vibecoding \vs\ Coding Using AI ✨