his works were notoriously critical of the government, despite doing so in somewhat subtle ways. Stalin was well known for brutal punishment for any political dissonance. I have not been able to locate any information about this, and need it desperately for my research project.
I'd flip the question slightly: why assume that Bulgakov should have been executed?
Writers in the USSR faced censorship, a stifling environment and tight patronage/control (under the RAPP and later Union of Writers) but they weren't necessarily subject to violence for their writings themselves. Under Stalinism the political elite took an interest in fostering the creative intelligentsia; writers were linked to a particular political patron who extended protection.
It was typically when such patrons themselves fell into disrepute that a writer's life might be endangered. For example, Babel and Koltsov were brought low by the fall Ezhov rather than their own writings per se. A writer could therefore stay just the right side of the censor (although not move into openly anti-Soviet territory) without fear of death.
Bulgakov himself was well aware of this protection from above, fantasising a scene in which Stalin shows him favour:
Motorcycle . . . brrm!!! In the Kremlin already! Misha goes into the hall, and there sits Stalin, Molotov, Voroshilov, Kaganovich, Mikoyan and Iagoda.
Misha stands in the door, taking a low bow.
STALIN: What's the matter? Why are you barefoot?
BULGAKOV (with a sad shrug): Well... I don't have any boots...
STALIN: What is this? My writer is going without boots? What an outrage! Iagoda, take off your boots, give them to him!
This doesn't mean of course that a writer might not face harassment from low-level officials or necessarily enjoy a thriving career, Bulgakov himself being proof enough of that. But a notable writer would have to be unlucky (in the fate of their patron) or openly anti-Soviet to actually court execution.
All of which wraps into the broader topic of Stalinist violence. This was not, even in the period 1936-38, entirely undirected and its employment was rarely straightforward or transparent.
Source of the Bulgakov quote is Fitzpatrick's Everyday Stalinism.
A suggestion - try getting in touch with the staff of the Bulgakov museum in Kyiv, website link. They are very knowledge in not only Bulgakov's history but also of his family and that time period and social history. They have published a lot of books as well, but all of them are in ukrainian and russian, as far as I'm aware, but perhaps they'd be willing to answer some of your questions.
Stalin was somewhat of a fan of Bulgakov; he attended the theater production of the 'Days of the Turbins' for more than fifteen times [1]
[1] Громов Евгений. Сталин. Власть и искусство. М.: Республика, 1998. ISBN 5-250-02598-6. pages 100—130.