"Isn't the internal energy of an ideal gas already defined to be the kinetic energy?"
Correct.
"If energy is conserved in the process, how can we end up with a hotter gas in the end?"
Because more work was done on the gas by pushing the piston slowly back in than was done by the gas pushing the piston out fast.
I look at it like this… First consider the extreme case: a gas escapes into a vacuum ("Joule expansion") The cylinder containing the gas and the expansion space that was originally evacuated are both thermally insulated. So we have adiabatic expansion when no work at all is done! Now consider a less extreme case when a piston moves out very fast, at a speed that isn't negligible compared with the rms speed of the molecules. This means that the gas pressure on the piston is less than that in the bulk of the gas, and less work is done than in a slow expansion between the same initial and final volumes.