The Rams have been going hard after a WR for a while. The Patriots weren't actively looking to trade Cooks from what I gather.
The Rams approached the Giants and approached the Patriots. A 1st and a 6th was just too good to pass up. Had he not been traded, the Patriots may well of paid him.
The fact that he got that kind of compensation again shows he's still seen as valuable.