This is because line_x_axis is not part of the surface, as seen by calling:
boundary = gmsh.model.getBoundary([(2, surface)])
print(f"{boundary=}, {line_x_axis=}")
Thus, if you instead add:
for boundary_dim, boundary_tag in boundary:
gmsh.model.addPhysicalGroup(boundary_dim, [boundary_tag], tag=boundary_tag)
you will get all your outer boundaries tagged.