Ah, yeah, that can be a problem with that method.
The simplest way to fix that is to first add something like the following to your JavaScript section:
// Fresh is true if you didn't come from a passage with a "menu" tag
window.Fresh = function () {
return !tags(previous()).includes('menu');
};
Next, just wrap any code which triggers macros or code that you don't want re-triggered when you come back to the passage inside the following code:
<<if Fresh()>>(code you want to only trigger once)<</if>>
Now that code will only get triggered if you come from a passage that doesn't have a "menu" tag. This will likely require modifying multiple passages, but I don't think that there's a solution which doesn't require that.
Hope that helps! :-)