With the assistance of some talented helpers on the AOE “AI Scriptures” #Modding Discord channel, I was able to solve this issue.
To recap, I was having a problem with just about any castle created unique Elite Units not experiencing a Modify Attribute change after I’d fired a trigger to modify an attribute–even though unique Elite Units already on the map when the game began, because I placed them on the map in the editor did experience a change.
Example Of The Problem:
–I fire a trigger increasing attack for Elite Longbowman.
–Elite Longbowman already on the map which were placed there by me in the editor experience +2 attack as expected.
–Elite Longbowman subsequently created by training them in the castle, after the above trigger fired, resulted in those units not experiencing a +2 attack as expected.
–I described the above phenomenon as “modifying attribute” not affecting "yet to be created” units in my original post.
Background Info:
My scenario is Post-Imperial, and there were already Elite Longbowman on the map which were placed there by me in the scenario editor. A player playing the scenario would also likely choose to create Elite Longbowman while playing the scenario.
The Fix:
When I made the scenario Post-Imperial, I knew that meant there would never be non-elite version of units on the map. That is, there would never be a “regular” Longbowman on the map. There would only ever be Elite Longbowman because Post-Imperial of course means that all technologies have been researched, including the one that upgrades Longbowman to Elite Longbowman.
So considering there would never be any regular Longbowman on the map, when I made my trigger to Modify Attribute (increase attack by +2), I only made a trigger to increase attack for Elite Longbowman (Unit ID 530), and likewise for all the other unique Elite Units. After all, why would I make a trigger increasing attack for the regular version of those unique units when my scenario was Post-Imperial age?
However as it turns out, when you click Train Elite Longbowman in the Castle, the game code appears to create a REGULAR Longbowman (Unit ID 8) at the moment you hit the train button, and at some point between that moment and the moment when it actually pops out of the castle, upgrade it to an Elite Longbowman—and the unit which pops out of the castle maintains its Unit ID of 8—it does not pop out as Unit ID 530 as you might expect even though it is an Elite Longbowman. It is likewise for all unique units which are created in the castle. Since my trigger affected only Unit ID 530 (Elite Longbowman which were placed by me in the editor), any units with Unit ID 8 (Elite Longbowman trained by me while playing the scenario) were not affected.
So, if you are Modifying Attribute of any castle created units in the editor, even if your scenario is Post-Imperial you need a trigger that has effects for both the regular version of the unit as well as the elite version of the unit. Again, in this example, my trigger needed to have an effect to Modify Attribute (increase attack +2) for both Unit ID 530 and Unit ID 8.
Notes:
This issue appears to be related to castle created units only. If you wanted to create a trigger to increase attack of an Elite Skimisher which is created in the archery range, you would only need a trigger to modify attack of Elite Skimishers, and not regular Skirmishers.
If you do not know the Unit IDs of both the regular and elite versions of units for which you want to Modify Attribute, you can find that information in the Advanced Genie Editor which comes standard with AOE 2 Definitive Edition.
If you have a problem along the lines of what I have described here go ahead and reply in the comments and I will do my best to help you.