In the sentence "そうですと思います", is です making the sentence grammatically incorrect? If so, why not in the sentence "「そうです」と言った" making it incorrect? Thanks in advance! Isn't it like "I think it probably is so." in a very very humble way?
Generally, です/ます before と is allowed when you use direct speech, i.e., when you quote someone's statement without changing it. Note that, however, brackets are optional in Japanese even when you use direct speech, as long as who said it was clear from the context or the choice of personal pronouns. The following sentences are all fine.
She said "I love you." (typical direct speech)
She said "I love you." (direct speech with brackets omitted)
She said she loves me. (typical indirect speech; です should not be used)
Likewise, そうですと言った (without brackets) is totally fine if someone actually said そうです out loud.
Next, you cannot directly quote someone's thoughts, and you don't use polite form when you think something within yourself. This means you should not use ます/です with 思う/考える/etc regardless of who thought it, and regardless of whether there are brackets. A rule of thumb is that "～ますと思う" and "～ですと思う" are almost always incorrect. As a rare exception, if you really feel you "said" something within yourself, ～ですと may appear.
I prayed to God within myself, "I want to be rich, please".