There's so much fear involved in trying to do something you don't know how to do that drugs and alcohol can become a big part of your life if you have an addictive personality or are very unsure, which most songwriters are.
The real danger of writing a great song when you're on something is that it might get you thinking that the only way to repeat that is by only writing when you're high.