I think the lesson here is to stay away from frameworks as much as possible.
Actually now in the end, I've found some frameworks that I like (love?) and ... without them, I'm afraid everything would instead have beeen a terrible mess. These frameworks help me structure the code and reduce my total amount of code: React.js, and Play Framework, and Nginx + some Lua (instead of doing everything in the app server).
My personal lesson is ... Do use frameworks but not the wrong ones :-) and it can take long to undo a use-the-wrong-stuff decision.