I think that thesis writing is a big project which can be divided into several small-scale tasks. The contribution of the thesis must be done with student himself/herself, but other tasks such as figure preparation, writing in LaTex, editing, training, advising, etc. can be outsourced. Am I right? In your opinion what kind of tasks can be outsourced and how?
In my opinion, the most ethical and legal answer to someone who is unethically and illegally asks others for writing his thesis (some parts or the whole) in any form (from doing research to typesetting and etc.) is a big NO!
By hearing NO!s from others, that person will understand that he is the only person who is responsible in writing his academic manuscript and he has social responsibility as a student to do his own research.
Thesis research is not something like procurement or construction project to be outsourced.
Help such person and help your society by saying NO to such requests!