How to create a menu block which is created by the active trail
Menu Block does cover your use case.

Go to /admin/config/user-interface/menu-block

You will see


  If a block is configured to use "the menu selected by the page", the block will be generated from the first "available" menu that contains a link to the page.


That screen is for administering which menus are available when the menu block is supposed to simply rely on the active trail to determine which menu to show.