This hasn't really been an issue at my work, however I'm still at a loss as to how I should learn to start from scratch and "architect" code in a way that makes sense and is complex. By this, I mean sometimes I'll look at a repo that's just a complex rest API and I'll be thinking "there's no way I'd be able to come up with this elegant structure or nested code in one sitting".
Is this a sign I just learn slowly or should I just resign myself to doing product management and non-coding stuff?
I also agree with db48x, the complex elegant solution you saw wasn't designed and done in one sitting. It was likely done over time and with a few prototypes and concepts that then got refined into a more elegant solution. Once you get enough experience, you will go through fewer iterations because you'll recognize patterns and when to apply them. Even then though you might prototype a couple of different ideas to test some theory.
Now if you say you've been coding professionally for 5-7 years and you are struggling still with basic architectures, then maybe there is something else going on.
I would even say that most people working in software can only fill in the blanks, they absolutely cannot start from scratch (which is in truth very hard).