8 – Dynamically load the menu items created from the links.task.yml file

I need to programmatically load the links that are generated from my_module.links.task.yml on another page.

My exact use case is that I have a set of links that are shown when viewing my node page. The links will be shown and hidden based on the current user’s access and the access control is handled through the options in the my_module.routing.yml file.

I need to create a separate page that displays node data in a table and I need to show these links in a drop-down option (similar to how the edit button functions when viewing content as an admin).

Is there a way to dynamically get the links so I can then display them in that drop-down?