Rapid contraction of giant planets orbiting the 20-million-year-old star V1298 Tau