I read somewhere that when Hamilton and Merc were signing the latest contract that Hamilton wanted a 3 year contract, but Merc insisted on a 1 year. So they compromised with a 2 year, that had "get-out" clauses for both sides.
It could be that part of Hamilton's decision was made because he might have felt somewhat snubbed by Merc for not wanting to sign him for the "long" term contract, and thus were displaying a diminishing of their faith in him.
That may well be part of what helped him decide to accept Ferrari's offer when it was made. It might be possible that Ferrari heard about the above and decided "nothing tried, nothing gained", and made their offer.
Also: he's worked with Vasseur before and they have a good relationship.
It's also a good bucket-list item..... how many of us could tick off "Raced for Ferrari in F1"??