Paul was not illiterate. He had the best Jewish education.
Peter did dictate to Mark.
The Jewish culture had literature but was mostly an oral tradition. It was a matter of routine for them to memorize scripture and be able to quote it and teach it word for word to their children.
The gospels are believed to have been written between 16 and 34 years after Jesus' death. The earliest reference we have to the gospels was ignatius who died in 115 A.D. So Mathew was clearly written before then. But since none of the gospels mention the destruction of Jerusalem which Jesus had prophesized. It's believed that they all must have been written prior to AD 70. The gospels are constantly pointing out fulfillment of prophecy, so for them not to include Jerusalem would be grossly out of character.
Let's not forget Luke was a Doctor.