Don’t contracts have to be two sided ? Like a promise to donate no strings attached, and then not donating is no breach of contract. If there are strings attached to donation and the other side promises signs off on the strings, then you have a contract but it’s not a one sided donation.
Giving up a large portion of your life to work for a company isn’t enough of a party to a contract in this regard? Someone could conceivably take this job over others, or not leave as early, if they have assurances of severance. It’s not a gift any more than paying someone for employment is a gift, so I don’t see how this has anything to do with charity.