Programmatically find menu item for a given path in main_menu, enable it if it was disabled

For a given path say /xyz , how to identify if there is a menu item in the main menu and if so enabled the menu if it was disabled.

This given path /xyz could be an alias or could point to an external url or route for a custom entity