FR: De-couple file-open from active-leaf-change

This post has been migrated from the obsidian-api repo:

Currently, the file-open event has a callback for the TFile opened. However, it provides no information as to the containing leaf of said TFile. I tried iterating through all open leaves, but found out that apparently they all contain the same TFile by reference, so… Is there not an actual way to find out the leaf for a file-open event?