Hang tight. You can clearly learn to fix these issues and become better at building/architecting solutions. Spend some time reviewing projects on github and see how others have tackled the issues you are struggling with. Practice by creating your own projects. They don't need to be complete but will allow you to try different strategies for structure, hard coded values etc.
You could become a PM if you really wanted to... the PM's I work with have zero coding experience. This would be difficult for me as I don't see a PM as being creative and I like to build things.
You can do this!