In some universities a few published papers are are a pre-requisit for submission of the thesis. This is a mandatory.
Otherwise I feel that it is better to publish papers after submission of the thesis. First of all preparing a MS, submitting it to a suitable periodical, attending the reviewers' comments and then checking the proof is definitely time consuming and to some extent the flow of thesis writing gets a bit hampered. Further, thesis submission is time bound and the stipulated time some of the research work might not be in full perfection. After submission there would be ample time for improving the individual papers more and more. So I feel that it is better to run after paper publishing after submission of the thesis unless it is urgently required for whatsoever means.
Agreed with Subir's comment i.e. it depends on each university's policy / criteria for PhD graduation. E.g. some universities required students to publish 1 or 2 articles, some universities even required those published articles must be in ISI-indexed journals, some universities don't need to or is optional etc. In my personal opinion it is good to have at least 1 article or conference proceeding published before PhD graduation. Reasons being:
article reviewers' critiques / comments can improve your thesis writing skills / future article writing skills (even though some of the critiques can be very negative).
published article can motivate you to write your thesis faster & complete your PhD earlier.
conference proceeding usually require a student to present his / her paper to a group of audience for Q&A in which such experience can help the student to prepare his / her PhD viva exam better in terms of preparation, readiness, Q&A handling, emotional & time management etc.
After PhD graduation, the graduate is encouraged to write more articles - for a start s/he can breakdown his or her thesis into few articles to be published.