Actually the rotation could be 180 degrees about any axis that is in the xy-plane, like the y-axis. So the x-axis is not the only correct answer.
To me it seems that the function is not working well. In this case there are infinite choices of correct axis, so the function should return at least one correct axis, for example the y-axis or the x-axis.
However, the axis matters if you want to do this rotation for a 3D body. For a 3D-body the result is different if you rotate 180 degrees about x-axis, or 180 degrees about y-axis. But from those two vectors, it is not possible to determine, whether you want a rotation about x-axis, or y-axis or some other axis in xy-plane.