To me, the way writing is most like music is in the state necessary to succeed in both.
After the mechanical part is sorted (master level) the only thing left is expressing yourself in a beautiful way.
If you are super aware and self conscious you WILL have trouble.
The state of flow necessary to make music is very similar to the state necessary for writing.
Both are very free of awareness in the mechanical part and fully present in the flow of the process.