Thank you for writing.
Ribbon tabs or groups added to a particular Contextual Tab will not be merged upon selecting the contextual item. Rather these elements will be highlighted together with the contextual tab. When implementing this feature we have followed the approach in Word and the Windows File Explorer which are behaving the same way.
Generally speaking, the contextual tabs are suitable in scenarios where you need to show or hide particular tabs depending on certain conditions or user actions. I am sending you attached a sample project which you can test as well as a gif file showing the result on my end.
I hope this helps. Let me know if you need further assistance.