I think what you are facing is a sense of how much the tools are just that - tools, and no substitute at all for what an experienced developer would try to plan for. So yes, I am sure everyone who's using AI tools for the first time has made this "newbie" mistake.
BUT I have also heard that the tools come with "modes" (or agents, or skills, or whatever you want to call them) where you can have it act _like_ an architect, that points out the things you ought to ALSO do. Like write tests, ensure idempotency etc.
I am curious what your experience would be if you went through some cycles of having the AI simply review its work and suggest improvements. Clearly you've already learned some things that you ought to add - I think documenting the progress you make as you discover these things would be immensely helpful to others like you who are new to this!
Good luck :)