When you add both upgrades and cosmetics that include upgrades, here's how the final stat is calculated:

 

The formula: (Base Stat X Upgrade) + Cosmetic Upgrades = Total Stat

Said another way, upgrades are calculated first and then any additional stats from cosmetics will be added on top.

 

Example:

You have a 200 stat. You add a mythic upgrade for a 5% boost. That's 200 x 1.05 = 210. Any cosmetic trait boost would be on top of the 210. Let's assumue you had a 20 point cosmetic boost. That stat would now be 230.

Your next mythic upgrade would be 210 x 1.05 = 221 plus the 20 point boost for 241.

NOTE: If you remove the cosmetic that is providing the boost, the boost will also be removed. The cosmetic will be burned (destroyed) and you will no longer have access to it.