I tried to fix that many times over the years, and after each fix, something changes in Rhino and it is broken again. For some versions it works, and for others - it doesn’t.
When opening a document, Rhino does its modifications, and at some point during the opening process it clears the modification flag. We also modify the document (loading defaults). When OnOpenDocument() is called we set the modification flag to FALSE. That is probably not a good idea, but it used to work.
I’ll see what can I do to not set (and reset) the modification flag at all, so Rhino maintains it all the time