Why do they write textbooks as lists of theorems and definitions, with unsolved exercises and proofs left to the reader?

The way you learn mathematics when you are an advanced college student, a grad student or even a fresh Ph.D. is very different from the way you do when you are in school. That is mainly because you need to acquire working knowledge about the subject and the potential ability to improve on it. For, you need an active attitude and an habit of independent thinking about the subject.

A well-chosen list of problems ranging from straightforward to difficult (or very difficult) is very useful to train your abilities.

In fact, having to think independently about the subject may help understanding its fine points. I remember, back in my undergrad years in Rome, a professor telling that the best way to approach a grad level textbook is: read first the statements of the theorems, then try to solve the exercises and only after that go back to the proofs of the theorems and try to understand them.

You may argue that long lists of problems like those in Hartshorne's Algebraic Geometry GTM book or Lang's (in)famous approach to homological algebra ("Take any textbook in homological algebra, read the statements and prove them") may not considered friendly to the student, but why learning in depth a technical subject should be regarded as needing a friendly approach?

Talking about exercises, I think there is a very important reason why answers should not be provided. A math problem may have different ways to be solved, sometimes using different ideas. If the author gives an answer, the student may be led to think that that way of tackling the problem is the standard one, or the canon. But this would discourage independent thinking which is--or should be--a main goal in teaching mathematics (or teaching anything except maybe religious dogma, for that matter).