Does writing a book consider working in Thailand?
No it does not, the immigration Police can never prove that you actually doing it and even if you finish the book you could have written it outside Thailand.
Same if you work on the computer from it does not consider work if you do some work for someone else and they will take your pass port copy then problem can start. So if you consider working for some one else make sure they will not tax you in Thailand.
If you exporting things from Thailand on a regular basis they can not really nail you down either if you not starting staff and having a office.
You can say that as long you work from home and not have staff you not need a work permit.