This would have happened whether or not you had a Figma design first. The problem is that you didn't write things so you could easily swap out the API (which is actually faster than just slapping crap together).
Dave Farley says for him code quality boils down to one thing: how easy it is to change your mind about. A lot of this stuff gets a lot easier if that's your North star.