I think there is a way to get it, but it's not going to be easy or pretty.
A you're trapping the OnAfterDock
, I guess you're not interested in floating panes. So, for docked panes, you can use CDockablePane::GetDefaultPaneDivider
(MSDN here), which returns - as MSDN says:
A valid CPaneDivider
object if the dockable pane is docked to the main frame window, or NULL if the dockable pane is not docked or if it is floating.
The CPaneDivider
object (MSDN here)
...divides two panes, divides two groups of panes, or separates a group of panes from the client area of the main frame window
The following partial screenshot says more:

So, for a regular pane divider, you can use the methods available on CPaneDivider
to find the other pane, or another embedded CPaneDivider
(so recursive interrogation necessary here) and check if the divider is horizontal or vertical etc.
For the other case described above, look at the CPaneContainerManager
class, which (again as MSDN says)
...manages the storage and display of the current docking layout
From here, you can again drill down through the whole docking hierarchy that starts from your original docked pane.
If I were you, I would really really look again at using EnableLoadDockState
or at least browse the MFC source code to see if there are any internal helper classes/functions that you can reuse.