Interplay between partner and ligand facilitates the folding and binding of an intrinsically disordered protein