See the edx links in one of the threads above. Take the course; Actually DO what Gregor repeatedly says in videos and you'll find what you missed.
>> The goal would be to end with as least amount of tech debt and codebase flexible enough to stand the test of time?
I am not sure if it is possible, to have a comprehensive book with this goal in mind. It very much depends on the project size, the dependencies and your language / framework -- and even if you have that in order, there are your teammates, the process, continuous integration, milestones/deadlines and the general workflow you have to take into consideration.
[0]: https://www.goodreads.com/book/show/18043011-clean-architect...
I wrote my book Professional PHP [0] as a guide like that, but of course it's heavily skewed towards building a PHP webapp (even though most of it is also applicable to other OOP languages).
But to be honest, I wouldn't try to narrow it down to a single book. Start with the classics like clean code, code complete 2, pragmatic programmer and then work yourself towards effective java, implementing domain driven design etc. I have a list of my recommendations published here [1].