Nope. It is a 3 body problem. If you see from rocket frame you are bringing rocket "virtually" to rest and this imposes acceleration of 2 m/s2 on each of the ball in -x direction.
You can do nothing more than that. You seem to be thinking that we find relative velocity of one ball w.r.t another. Albeit, that doesn't mean that you ignore acceleration of rocket.
You can't convert this 3 body problem to one body.
The acceleration of the rocket doesn't matter when collisions aren't assumed to happen. Just see one ball w.r.t. the other. Answer is 8 sec only.
You can solve it from the rocket frame if you like, you will get the same answer.