As far as I know, there is no way to build any decision-making logic into a Preset. I’m no expert but I have developed many of my own custom presets and have often wished for a way to make simple decisions within the XML code.
Someone else may provide more information but one definition of the XML file structure is as follows: “They are plain text files that don’t do anything in and of themselves except to describe the transportation, structure, and storage of data.” That would indicate to me that the XML format was never meant to be used programmatically.
I hoped, that there is an option to tell JOSM via this XML file how to handle keys depending on the selection. node selected: this set of keys closedway selected: another set of keys
In this case this would help.
But I have no idea if it’s really needed often.
I understand what you want to do but I repeat: you cannot use XML to make a decision to do tag an object differently based on whether it’s a node or a closed way.