I have posted a paper on ArXiv and submitted it to a journal which is under review. Can I include a part of it or the whole article (pre-print) as a chapter in the thesis? Will it be counted as self-plagiarism? Do I need to paraphrase everything on the paper? If I include it in the thesis and the paper gets accepted by the journal (before or after the defense), can I still go ahead with the publishing process?
What you can include in a thesis is up to your university. Standards vary widely. If you cite the paper it isn't plagiarism. But the journal you submitted it to may want copyright and both the preprint and including it in a thesis might interfere with that, though this depends on a lot of other things.
Citing prevents self-plagiarism charges but doesn't help with copyright issues that you have to talk to the journal about. Likewise you need to discuss this issue with your university, probably through your advisor.
Many journals permit preprints. Many give a license back to authors for things like inclusion in a thesis, but you have to check.