I think Lehner's real issues came out a bit later in Buffalo, heck his first two season in Buffalo were pretty strong and it was in NYI where he was able to fight some of those demons; when we traded him he was still very young at 23, so a bit of inconsistencies was to be expected, and while the team likely knew more than the fans, he was still seen as a very promising kid, while Anderson was aging.
With all the info we gave today, the trade makes sense, especially if you don't think he'd have been able to overcome his demons without being bounced around. But at the time, it was a bit frustrating to have had both Lehner and Bishop and stuck with an aging Anderson, only to see both putting up .920 sv% with their new teams.