Has anyone ever seen an employment clause like this before? Is it even legal?
The clause is lawful. However, its enforceability can be forfeited unless (1) the employer commits to hire whoever your daughter's referral is, or (2) the contract outlines clearly enough how to proceed in the event that the proposed replacement is unacceptable to the employer.
The clause is not to be construed as suppressing your daughter's statutory right to terminate at will her employment (CA Labor Code §2922) or to perform training for free. Instead, the clause essentially requires your daughter to plan ahead so that the employer has a replacement by the time her resignation becomes effective (hence the contract language "before you leave").
The employer's rejection of the referral would forfeit its entitlement insofar as it hinders the transition your daughter is or will be planning for the company. To preclude forfeiture in this scenario, the employer would have the difficult task of proving that --in doing the referral and/or training-- your daughter violated the covenant of good faith and fair dealing that is implied in every contract.
In the alternative, the contract would need to include language that reasonably informs your daughter about the constraints applicable to the referral & training process. The constraints themselves have to be reasonable. For instance, your daughter cannot be asked to provide a referral whose experience or qualifications exceed your daughter's.
Lastly, neither the lawfulness of a clause nor its enforceability precludes your daughter's freedom to propose or require different terms in the contract. In some contexts, negotiations are easier before signing a contract whereas in others an amendment is more practical.