Was it and is it a common Christian belief to say that the 5 books of the Torah were written by Moses?
The short answer is yes.
It is and has been traditionally believed that Moses wrote the 5 Books of the Torah!
The first five books of the Bible, known as the Torah (a Hebrew word meaning “Law” and “to instruct.”) and also known as the Pentateuch (from Greek meaning five scrolls), are Genesis, Exodus, Leviticus, Numbers, and Deuteronomy. Moses is acknowledged by most conservative Bible scholars as being the principal author of these five books. Many passages in the Bible attribute those books to Moses or as being his words:
Then the Lord said to Moses, “Write this as a memorial in a book and recite it in the ears of Joshua, that I will utterly blot out the memory of Amalek from under heaven” (Exodus 17:14).
And Moses wrote down all the words of the Lord (Exodus 24:4).
These are the stages of the people of Israel, when they went out of the land of Egypt by their companies under the leadership of Moses and Aaron. 2 Moses wrote down their starting places, stage by stage, by command of the Lord (Numbers 33:1-2).
Then Moses wrote this law and gave it to the priests, the sons of Levi, who carried the ark of the covenant of the Lord, and to all the elders of Israel (Deuteronomy 31:9).
In Joshua 1:7 those first five book of the Bible are said to be the “law (Torah) which Moses My servant commanded you” and “the law of Moses” in 1 Kings 2:3. Perhaps the clearest evidences for Moses being the author of the Pentateuch is that Jesus Himself refers this section of the Old Testament as the “Law of Moses” (Luke 24:44).
Some verses in the Pentateuch appear to have been added by someone later than Moses, for example, Deuteronomy 34:5–8, which describes the death and burial of Moses. But most scholars attribute the majority of these books to Moses. Even if Joshua or someone else actually wrote the original manuscripts, the teaching and revelation can be traced from God through Moses.
Was it mainstream belief before the documentary hypothesis, and is it still mainstream belief now?
Yes, of course it was!
The Jewish Scribes and Pharisees and their religious leaders have always attributed authorship of the Torah to be Moses. Jesus himself referred to those first five books as “the Law of Moses”.
As a matter of interest, the 1917 English version of the Jewish Bible divides the Old Testament into its traditional Hebrew sections. The four sections include the Chumash (The Five Books of Moses), the Neviim (The Prophets), the Treisar (The Minor Prophets) and the Ketuvim (The Writings). The order of the five books of Moses, including their Hebrew names, is as follows:
Chumash / Torah / The Five Books of Moses
Bereshit / Genesis
Shemot / Exodus
VaYikra / Leviticus
BaMidbar / Numbers
Devarim / Deuteronomy
I would be utterly amazed if there was any difference of opinion between Protestants or Catholics on this question.
P.S. It is also interesting to note that Psalm 90 is attributed as being “a prayer of Moses the man of God”.
Addendum: I found this question (Did Moses write Deuteronomy 33:4?) which I found quite relevant.