When editing a record in the subpanel the context of the sidebar is incorrect because the create and list actions of another module appear

I have identified an unexpected behavior. And it is that when editing a record in a subpanel the context of the sidebar is not correct.

I have created a custom module and I have added a many-to-many relationship with other modules. Everything works as expected. But I just identified that when editing a record in the subpanel the context of the sidebar is incorrect because the create and list actions of another module appear

Here I expect the context of the module I edit to appear but the context of another module appears instead

Could you give me a clue to check because I don’t know how to solve this scenario

Regards and thanks in advance