Except you then have nothing to implement the system on. You see you cannot start building a tower half way up as it will fall down (since the base is not there to support it).
There is also no "one size fits all" system to your problem. It will need many different parts to create a fully working solution.
each hero have 4 skills: soldier, engineer, mechanic and scientist. they all need to present at all times
A good way to implement this would be as attributes since this will then give each hero special integers representing progression. An Attribute is a class in the Behaviour catalogue which gives a unit a special quantified field that improves the unit in some way. This is similar to hero attributes in WC3 (Intelligence, Agility and Strength) but more flexible as you can define exactly what each attribute does and how many attributes a unit should have. Attributes may improve a hero in no way directly but be used by triggers for certain results.
Start by creating your 4 hero attributes and setting the range you want them to be. The granularity involved should be for visible improvement and as a gauge of progression. It should be abstracted away from direct upgrade unless a certain action specifically makes a noticeable improvement. Having numbers like "20,000" would be silly but hundreds is alright for a maximum. Attributes like Soldier you may want to add HP or things but I do not know as the details what it does is unclear from your description.
After you have your basic attributes, add them to your hero units (created by my previous instructions...) and this will make the foundation of your heroes.
Next give your engineer class the things you want it to make via a build ability. Look at SCV build for an example. Then add requirements to the various building types which require you have a certain amount of Engineering attribute for them to be unlocked. If this is not possible make it require a Buff behaviour that can be given to the unit at certain amounts of attribute. All other classes get a build ability that allows friendly targeting but no actual buildings so that they can help build but not start foundations.
On to levelling up Engineering now using triggers. Every time a new building is started you award engineering attribute to the hero. There is an action to change attribute quantity. If that is not what is desired (again, you were ambiguous) then you can start a trigger thread that monitors the buildings construction status. Every time its construction status changes you search all nearby units for those building it nearby. Award each of these units some custom unit value (choose an index to represent engineering progression, keep this consistent throughout all triggers, I advise a constant is used to allow index changes as required) and if that value exceeds a threshold (like 1.0) then you reset it to 0 and award the unit an attribute point in engineering.
I believe you can set attributes by adding behaviour charges, but I am not sure.
Once you get a small part like that working, the rest is kind of similar. For abilities that use attribute points you use a trigger enhanced end effect (where a trigger event is fired by the end effect) that then computes the desired effect factoring in the attribute. Events such as taking damage or making kills could increase soldier skills in a similar way.
When a unit gets in another unit such a turret. You could add a buff behaviour to the turret based on soldier attribute that boosts damage and attack speed etc. The number of stacks added represents how much it is to be boosted and would depend on the soldier attribute amount.