From the Legendre diffeomorphism to double Lie algebroids