This depends on where you are and what are the traditions of the places you would intend to apply to for a doctorate. It would also depend on the field, which you state as mathematics.
However, the advantage of the thesis is that you get some direction in creating it, but probably less direction in the writing of a set of papers.
The other thing is that a thesis comes with a fairly definite end point. You write it, someone reads and approves it and you are done. With papers, it is much less definite as you then depend on getting the papers accepted somewhere. Depending on your field and the publishing venue this can take a long time. There are questions here that suggest that eighteen months in review happens frequently enough to be alarming.
Note that a thesis normally ins't "a book" though in some fields (not likely math) it could be. In the sciences rather than the arts or humanities, it is normally a scientific study of some kind with a written summary of methodology and results. In mathematics the thesis could either be strictly (theoretical) mathematics or an associated philosophy or historical study. If it is a theoretical thesis then you need a suitable problem to work on. Moreover you need to be able to make progress on that problem in some way. Finding a problem can be difficult (hence the advisor) as some are too easy, some are too hard, and some are just right. But you aren't normally expected, as a master's student to come up with your own problem, though this varies by place.
I'm also going to guess that the non-thesis option isn't designed to leave you a lot of time to write independent papers. Normally it would be filled with coursework that has its own (time consuming) requirements. Most places, the thesis option would imply a bit less course work and more "quality time" with an advisor or research group working on some problem or study.
You can be successful with either. You can also be successful if you do the non-thesis option and don't produce any publishable research along the way. Acceptance into a doctoral program can be achieved through a variety of paths, as long as they predict success in scientific/mathematical studies and research.
You don't, in fact, need to prove that you don't actually need the guidance of a doctoral program just to be admitted to it. You aren't there to prove to people that you don't need to be there.
Finally, let me note that scientific/mathematical writing isn't just writing. You need something to write about. That is the research part that needs to precede any writing that explains the methodology and results. If you don't do that, then you have nothing to write about.