Just one personal anecdote: I definitely find contradictions or gaps in my thinking/knowledge when I write. Finding and resolving those deficiencies is what I point to when I say "writing is thinking".