As Picasso said, inspiration exists, but it has to find you working.
Bach seems to have been the exception to the general rule that with high output comes a lot of lower quality work: one of the many remarkable things about his career is the consistent high quality of his output. He just never wrote a bad piece.
I agree on the constraints thing. It has become something of a fad to have “complete creative freedom” and to eliminate all “constraints.” But these constraints do indeed stimulate creativity. Which is why even average sonnets or haiku so often seem far better than free verse or thyme-free poems. And why even today, more than two centuries after its invention, composers still regularly mould movements into sonata form. And why the basic categories in art, such as landscape, portrait and still life remain popular.