Gowers has written a paper where he distinguishes between two cultures of mathematics: theory builders and problem solvers.
There are many textbooks on "how to solve mathematical problems", or "how to prove things", such as Pólya's books, e.g. this one. I have looked at a few of them in the past, and so far as I can remember, they tend to have a "problem solver" perspective.
Are there such "how to do mathematics" books that take a theory-builder perspective?
I don't know exactly what are you looking for.
But maybe reading about history, philosophy and the biography of the mainly theory-builder of math can help you to understand how they worked.