An external executable can see the same info, i.e. the browser windows and the tabs on each window. There's no additional information to associate the tabs of the previous session to the tabs in the new session.
In principle, it could be possible to identify the tabs by their position in the tab strip (which will be the same after restoring the session). However, if you have multiple browser windows, then the tab positions are no longer unique because there will be a tab on position 1 on the window A, and also a tab on position 1 on the window B.
The URLs of the tabs could also be used as an additional piece of information to uniquely identify them, but that's still not enough because multiple tabs can have the same URL.
In the end, there's no proper solution to the problem without help from the browser itself (which we don't have).