Effective three-nucleon forces from the folded diagram expansion