This is because you send in three-dimensional coordinates, while the VectorElement defaults to a 2D mesh (not a manifold in 3D).
With some slight alterations to your code:
from dolfinx.fem import FunctionSpace
from dolfinx.mesh import create_mesh
from mpi4py import MPI
import ufl
import numpy as np
gdim, shape, degree = 2, "triangle", 1
cell = ufl.Cell(shape, geometric_dimension=gdim)
domain = ufl.Mesh(ufl.VectorElement("Lagrange", cell, degree))
x = np.array([[0., 0., 0.], [0., 1., 0.], [1., 1., 0.]])
cells = np.array([[0, 1, 2]], dtype=np.int64)
mesh = create_mesh(MPI.COMM_WORLD, cells, x[:, :gdim], domain)
V = FunctionSpace(mesh, ("P", 1))
print(V.tabulate_dof_coordinates(), mesh.geometry.dim)
the code runs without error and prints:
[[0. 0. 0.]
[0. 1. 0.]
[1. 1. 0.]] 2