Superconductivity in the three-band model of cuprates: Variational wave function study and relation to the single-band case