I ended up doing as @MartinDotNet suggested — creating dummy root span at the beginning, and using it as a parent for the future spans. The main point that I was missing is that children can be attached to the parent span even after parent is already closed.