In Sweden the doctoral theses may be in the form of a monograph or in the form of a series of papers presented together with a summary to bind and tie them all ("compilation thesis").
Regarding the compilation theses, it seems, at LTH at least, that it is not strictly required that the papers be published already:
The articles should be of the quality required for publication in international journals.
Nevertheless, I remember distinctly that supervisors expected that, by the time you made your Licentiate dissertation (i.e., about half-way to the doctorate), at least two or three papers be submitted or ready to be submitted to a journal. By the time you are ready to defend the PhD thesis, the submitted papers might be already published or at least accepted, plus maybe two other papers at varying stages.
This, of course, varies and depends on the thesis subject, the study plan, the supervisor criteria, the common practice in your academic Department, even on what's common in the discipline or field of study.
Generally, as stated in the first link, many consider that
there should be more emphasis on the content of what is published than on the number of articles.