I agree that the relative velocity of the balls is not constant. However, the CM cannot be said to "bounce" elastically (or otherwise) until the collision is complete. Let me explain.
Shown below is a sequence of frames illustrating the collision of the CM with the wall. The balls have equal speeds ##v## along the horizontal. Velocity arrows are omitted to reduce clutter. The color code is:
Lime green → moves to the
Left;
Red → moves to the
Right. The CTC (center-to-center) separation between balls is ##d## and the red dashed vertical line is parallel to the wall at the point of closest approach of the CM.
The onset of the collision of the two-mass system is when the left mass hits the wall at ##t=0## as shown in the first frame; it is over when both masses have reversed direction and the information that one part of the system has collided with the wall is transmitted to the other part. This is shown in the last frame. The collision duration is ##\Delta t=\dfrac{d-2R}{v}.##
View attachment 358733
This is a simple 1D example with the common velocity in the CTC direction. For a tube of length ##L##, the period of horizontal oscillations is $$T_{\text{hor}}=2\times\left(\Delta t +\frac{L-2d}{v}\right)=\frac{2}{v}(L-2R)$$and is independent of the separation ##d##.
Similarly, it can be shown that if the CTC is horizontal, but the common velocity is vertical, the period of vertical oscillations for a tube of width ##W## is $$T_{\text{ver}}=\frac{2}{v}(W-2R)$$as the balls bounce up and down without colliding with each other.
I stop here. This is a live homework problem after all.