Maybe,
Your sentence is formal or literature type.
I think auxiliary + subject has to be used after expressions contain " only "
.
If you delete " did ",
The sentence will be like,
Only after she died, I realized that she was actually a nice person. ( is this sentence ok ?)...