This is an idea I've seen expressed in Elizabeth Gilbert's Big Magic, and now here, by Casey Neistat. It's another facet of something Brenda Ueland wrote in 1938 in If You Want To Write:
I want to assure you with all earnestness, that no writing is a waste of time, -no creative work where the feelings, the imagination, the intelligence must work. With every sentence you write, you have learned something. It has done you good. It has stretched your understanding. I know that. Even if I knew for certain that I would never have anything published again, and would never make another cent from it, I would still keep on writing.