Not on a level-by-level basis. After a certain amount of levels, I am not completely sure how many, the upgrade cost maxes out and won't rise further. So in the long run it is far better to only upgrade once every few levels. If you really need to upgrade at all: there is so much loot in this game, you will be tripping over gear that is better than what you are currently wearing. I used to hang on to certain parts because of how they looked, but with transmogrification that isn't necessary anymore either.
Upgrading legendary armor is not a good idea. It is the most expensive, but it also has a unique feature in that the entire set automatically levels up when you receive the last piece.
So say you have these pieces:
- head level 9
- torso level 18
- legs level 23
- hands level 28
Then, when you receive the feet and they are level 35, all the other pieces will automatically become level 35 as well.
Do note that all pieces have to be in your inventory the moment you receive the last piece, otherwise it won't work.
As for selling/dismantling: I sold my gear for most of the game, and I am currently sitting on 1.200.000 drachmae and I have no idea what to do with it. So I would say it is better to find a balance: dismantle the grey/blue pieces and sell only the purple stuff, for example.