They need wingers that can score goals, and they have a surplus of puck movers. Barrie is the logical one to move on from with Bouchard looking like a top 4D this year and likely to be a consistent top pairing D as early as next season.
Kubalik can play both sides, which is something they seem to be targeting with winger acquisitions (Hyman, Foegele). If they are able to retain Yams at a reasonable price or if he departs, obtain another 3rd line player in addition to Holloway coming in by next season. They will have legitimate top 9 depth for the first time since 05-06.
They need a third line that can consistently outscore its competition or at the very least not be a pincushion for the rest of the league when they're out there.
Wingers are what this team will be getting in spades year after year through their farm system, so spending their best trade chips to acquire one in his late 20s is what would qualify as 'frivolous '.
Look at Kubalik with an open mind and you'll see a player that is regressing to the mean. He's always been a limited player. Teams are wise to his game and it's probably pretty likely you'll never see him hit 30 again.
Why is this the player worth pursuing while Barrie, the consistently better producer, the player the team needs to part with? I'm not even saying that Barrie needs to be retained, it's just a really odd trade-off when you're suggesting that Kubalik is worth the cost of acquisition on top of the cost of his extension.
Fact of the matter is that the Oilers probably shouldn't be looking for many more 30 goal guys. They can't afford them in the future. They're much better off having half a dozen or so guys scoring 8-15 throughout a full season without being a total liability.