RhinoDoc.Create invalidates object ids for other RhinoDoc

I have the following code, and it throws exception “b”. It seems that calling RhinoDoc.Create(null) is invalidating the object id for the sphere in the first doc, but I thought objects in separate docs should be separate. Any ideas what’s going on?

   var brep = new Sphere(Point3d.Origin, 1).ToBrep();
   var id = panel.m_Doc.Objects.Add(brep);
   if (panel.m_Doc.Objects.FindId(id) == null)
   {
       throw new Exception("a");
   }
   var test = RhinoDoc.Create(null);
   if (panel.m_Doc.Objects.FindId(id) == null)
   {
       throw new Exception("b");
   }

If you want to create a document that is not associated with a running Rhino, use RhinoDoc.CreateHeadless(templateFile) instead of RhinoDoc.Create(templateFile)

https://developer.rhino3d.com/api/rhinocommon/rhino.rhinodoc/createheadless#(string)