A good argument could be made that the bonuses are a result of the market; that's what it takes to get people in the door. Thus any "contract" associated with the bonus is void for want of consideration. The bonus and the expense of training a first officer is merely the cost of doing business. Nothing more. A company could avoid this problem by delaying bonus payments until a certain amount of time has elapsed or attaching the payments to certain milestones, but no one should have to indenture themselves to receive compensation.
The CTP year contract is different: you get an ATP through their program and use their testing facility. A contract for hiring bonuses is different and may not be enforceable. Not that I know anything about that.