My memory of the chronology of Heinlein and his medical problems goes about like this:
He was doing fine up until he was part way through writing I Will Fear No Evil. Part way through work on that book he began having medical problems -- the aforementioned restriction of blood to his brain. He managed to finish the first draft and some polishing, but eventually Ginny Heinlein had to send the manuscript off to the publisher in its not-quite-finished state.
Heinlein then didn't write anything for a number of years. Corrective surgery improved his health (eventually). Time Enough for Love was his first book post-surgery.
Someone with more fannish knowledge will surely correct me if I'm wrong.