Convention of potential energy in dipole and the conservation of energy

As I understand it, the convention for the potential energy of a dipole in a uniform electric field has the following zero point:

$U(\pi/2)=0$

I understand how this makes the calculation easier to solve, however I can't help but wonder if this doesn't go in against the law of the conservation of energy:

Imagine a electric dipole placed in a uniform field with an angle of $\pi/2$ to said field. The electric field will put a torque on the dipole, reducing the angle to $0$. According to this convention the potential energy is now at its maximum. However when we now turn off the electric field there is no restoring force on the dipole. If we now replace the dipole with a second dipole, with no potential energy stored in it, there would be no way of differentiating between the two.

Doesn't this mean, using this convention, that energy is lost when stored inside a dipole?

Imagine a electric dipole placed in a uniform field with an angle of π/2 to said field. The electric field will put a torque on the dipole, reducing the angle to 0.

Almost. There will be a torque which will begin to rotate the dipole toward a zero angle. This results in a decrease in potential energy and an increase in kinetic energy and angular momentum. When the dipole reaches zero, however, it doesn't stop. It has angular momentum, so it will continue past zero. If the external electric field remains on, there will be a torque opposite the angular momentum which will cause the dipole to slow down and stop, then swing back toward zero again.

If you stop the electric field at any point, the dipole will continue to move. The system has whatever kinetic energy belongs to the rotation of the dipole, which of course will radiate and eventually stop.

When you turned on the field, you changed the potential energy of the system by +pE. The electrical potential energy formally was 0, and the kinetic energy was 0 for a total mechanical energy of 0. But the system was not constrained and could change position to have a lower potential energy. When the dipole reached the zero angle, the kinetic energy was equal to pE and the system potential energy, - pE for a total mechanical energy of 0.

When a dipole (with dipole moment $\vec{p}$) is placed in an external electric field $\vec{E}$, it experiences a torque,

$$\vec{\tau}=\vec{p}\times\vec{E}$$

whose magnitude is given by $\tau=pEsin\theta$. The rotation is to minimize the free energy of the dipole to attain a stable configuration with respect to the external field. The work done by the electric field to rotate the dipole is stored in the system as the interaction energy:

$$U=-\vec{p}\cdot\vec{E}=-pEcos\theta$$

As you imagined, let initially the dipole moment was aligned perpendicular to the external field ($\theta=\pi/2$). Then the torque experienced by the dipole will be maximum ($pE$). So the dipole rotates and when it get aligned parallel to the field the torque reduces to zero. At this point the dipole has completed a turn of $\pi/2$ and is now parallel to the field ($\theta=0$); hence the potential energy stored in the system is now $-pE$.
The energy is conserved here. If that's not the case, then it will violate the energy conservation. That is, if you turn off the field, and nothing is providing work and still the dipole is storing the potential energy due to some work. That will not happen. We can derive the torque from the potential energy expression by simply differentiating it with respect to $\theta$. That's the fundamental idea how we derived these expressions. It can be done only under the assumption that the forces are conservative.