Failure in importing second-order mesh in legacy FEniCS

Legacy FEniCS does not have out of the box support for second order meshes. One would manually have to permute the topological entities when adding them through the use of dolfin.MeshEditor.
Some of this has been explained in: Generation of second-order triangular meshes in legacy FEniCS - #4 by dokken

Maybe what you need is implemented in DOLFINy? (dolfiny/src/dolfiny/continuation.py at 39ddc50e99e38235c2aac8c489605726fbee64df · fenics-dolfiny/dolfiny · GitHub, ref: file:///home/dokken/Downloads/fenics2022-tdc-zilian-2.pdf)