What incentives do academics have to write text books? As noted in this question, academics should write research articles. In many fields, these are way more important than books. It's original research that counts for getting a PhD position, a post-doc, a tenure-track position, grants, etcetera. Writing a good textbook about an advanced subject is very difficult and very time-consuming. Its advanced nature means it won't sell many copies, so the money can't be much. Then why is anybody writing advanced scientific textbooks at all? What are the incentives?
Another reason to write an advanced text is that you have developed a body of research around a topic, and it's stabilized enough that you can present the material in a structured form. The incentive here is that the distilled understanding helps you understand your field, and it helps others work in the area as well. In addition, a well-written book can get you lots of citations, impact, and recognition (the same kinds of things you get with papers, but possibly even more).