I would argue that what you see is "correct" behavior albeit different than for menus in MDI context. Hence, requires redesign of some "active-window" dependent code.
Menu is not a window control although it belongs to a window. For MDI you have special circumstance that MDI sheet's menu displays inside the MDI frame. Hence, sheet menu hides the frame menu until you close the sheet. Some sheets may have no menu. For such sheet the frame menu remains visible.
Note for menus: No GetFocus/LoseFocus events in PowerScript. So focus doesn't move - and sheet remains active despite menu item's selected/clicked events.
RibbonBar control is regular control so click on enabled RibbonBar will move focus to that control and therefore activate the "container" window. That gets confusing when using MDI because the "active" sheet takes back focus/activation "immediately afterwards".
My current opinion is that RibbonBar is ill-suited for placement on MDI frame - because MDI requires a menu on the frame. Looking at Microsoft's apps using ribbon controls they place the ribbon inside each "document" window = inside each sheet. And they don't use MDI anymore. Instead they have all transitioned from MDI into multi-SDI for lack of better term.
HTH /Michael