Vanilla's approach doesn't make sense, so here's mine. If you don't yet know anything about EDU and EDB then you will probably need to go find some tutorials. I'm not going to waste our time explaining things that have already been explained.
Firstly here are the building capabilities:
weapon_melee_blade
weapon_melee_simple
weapon_missile_mechanical
weapon_artillery_mechanical
weapon_missile_gunpowder
weapon_artillery_gunpowder
And now here are the weapon technology types:
melee_blade
melee_simple
missile_mechanical
artillery_mechanical
missile_gunpowder
artillery_gunpowder
Note that I separated the gunpowder technology. This is because the gunpowder technology type causes fear on successful attacks. So, without using the gunpowder types, we have 4 distinctions we can make for melee weapon upgrades.
In my mod I define them as Spear, Axe, Sword and Mace. Gunners use missile_gunpowder and all artillery uses artillery_gunpowder. All that's left to do is revise strat.txt so that the names of the tech types reflect the weapons of the units that use them.
To introduce them into the campaign I duplicated the Swordsmith Guild, so now I have Axesmith, Macesmith and Spearsmith Guilds too. It's a nice but unnecessary touch, the system is my coding and really nothing to do with making new buildings. Another example of using this system might be to have a distinction between high, medium and low quality weapons, or something like that. The important thing to focus on is the mechanic the system creates, not the specific way I used it.
So the only problem I still have in my system, with missile units being upgraded according to their missile weapon (the vanilla nonsense), is with gunners. And the benefit is a more detailed upgrade mechanic = Better gameplay.
-----------------------------------------
Please feel free to ask questions