All XP goes to anything that can accept it. It's not divided up: if you get 50 XP, and two items can accept it, they both get 50 XP*.
It absolutely is worth swapping in green items and then sharding them: any slot that's full is not collecting XP that it could be.
[spoiler]* Don't believe me? Do some bounties, then do some science and prove me wrong. Facts aren't open to debate.[/spoiler]
English
-
I didn't know that!!
-
Oh, and you don't need to actually purchase any of the upgrades to make gear generate more items when you scrap it: just unlocking the upgrades is enough.