It happens to be so that gas between two pistons that accelerate with the same acceleration, changes. It may become liquid, for example. And a piston observes the distance of pistons changing.
While in the case where those accelerating pistons are connected with a strong rope, the distance of the two pistons stays constant in both pistons' frames. Everything in the frame of a piston stays constant in this case. An inertial observer observes that proper distances stay constant, and proper temperatures, by which I mean temperatures measured by a thermometer co-moving with the gas. To the question "what is the coordinate-temperatuere" my answer is that such thing as coordinate-temperature does not exist.
The pistons are inside a very long cylinder.
The other question is much better, the question about work. The side walls of the box do work on the gas. The kinetic energy of the side walls does the work.
When a mass hanging on a rope is accelerated by pulling the almost massless rope, the pulling force is highest at the mass end of the rope. That means that the rope gains momentum that points bacwards. If the kinetic energy of the rope is its speed times all the momentum that is in the rope, then we can see how as time passes momentum that has a decreasing effect on kinetic energy gets stored in the rope. By the way the forces at the two ends of the rope are different, there is no error there.