Nope, no tutorials, but I know how to do this myself.
You'll have to edit both the object data and make a trigger.
For the object data, check out "Item\Power Up\Glyph of Fortification," and what that does. You can base an item upgrade off that.
You'll also have to go into the Abilities tab and check out the Glyph of Fortification item ability: "Abilities\Special\Items\Glyph of Fortification"
In order to not waste your gold by accidentally buying multiple upgrades, something like this trigger should help:
-
Purchasable Upgrade
-

Events
-


Unit - A unit Sells an item (from shop)
-

Conditions
-


(Item-class of (Sold Item)) Equal to Powerup
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Item-type of (Sold Item)) Equal to Mercenary Contract
-




(Current research level of Mercenary Contract for (Owner of (Buying unit))) Equal to 1
-



Then - Actions
-




Set TempForce = (Player group((Owner of (Buying unit))))
-




Game - Display to TempForce the text: You already have that upgrade.
-




Custom script: call DestroyForce(udg_TempForce)
-




Item - Remove (Sold Item)
-




Player - Add 300 to (Owner of (Buying unit)) Current gold
-



Else - Actions
Modify the gold and lumber values to suit your needs, depending on how much the upgrade you make costs.
You can change the requirements here in the trigger, too, for whether or not the player has a neutral hero, and refund/reset the upgrade that way.
Mind you, this method will instantly give the player the upgrade.
Alternatively, you could do the other thing you mentioned.
Put the upgrade on each racial structure somewhere, then go into "Advanced\Gameplay Constants\Techtree Dependency Equivalents."
Choose one of the tier 4 through 9 sections, and add all the neutral heroes to the list there.
Below that, for the text section, type in something like: "Requires a Tavern Hero," or something.
Whatever tier you use, you can set the requirements for the upgrade to be that.
For Example: Upgrade Requirements = "Equivalents\Any Tier 4 Hall"; in the object data.