I think it'd be good to go a little further than this -- removing the magic path detection in getDocumentForPath() and explicitly creating the untitled doc right here, only in this case.

It's true that other code might call getDocumentForPath() with the untitled doc's fullPath, but if the untitled doc exists it is guaranteed to be found in _openDocuments.  The existing "magic path" codepath is only used for the doc's initial creation.