Hi Tim,
Thanks for reaching out on the forum.
The menu IDs used to be quite dynamic indeed. In recent releases changes have been made to make the menu IDs consistent.
In the release notes of version 10.4.0 you will see that issue LS-38355 has been addressed to make the menu items consistent.
In version 10.4.1 another fix on menu ids was done (LS-39733).
Perhaps you can give version 10.4.1 a try and see if this helps you to find a solution.
If not, then please raise a case through the customer portal so our support team can have a look at your solution and work with you to achieve the goal you are looking for.
Best regards,
Roger van Valen