D'Agostini was a healthy scratch with the Habs and had to go through waivers (and wouldn't have cleared). Palushaj was younger and waiver exempt with seemingly some upside (he was picked right after Subban in 2007) so the Habs got what they could for an player clearly on the outside looking in. It made perfect sense, too bad it didn't work out too well for Montreal.
The trade made perfect sense then, and still makes perfect sense today even if Palushaj is gone.
Not all prospects reach their upside. Any time you turn a player who can't make your roster, and you are likely to lose for free on waivers, into a decent prospect who was a PPG AHL player, and a 2nd round pick, thats a good move. You rolled the dice on Palushaj, and unfortunately it didn't work out... but the risk/reward here says it was a smart move cause Dagostini couldn't crack our lineup anyway.
Its like say your pockets are full, and you can't fit one more coin in there... you trade a loonie for a lottery ticket with a 50/50 chance, payout $2. Its a smart move, cause that Loonie was just gonna get lost in the cushions on the subway anyway.