From my understanding of the dsge_likelihood function, there is a conflict between the endogenous_prior and analytical_derivation options in the estimation command.
Specifically, the code does not compute the analytical derivative of the endogenous prior with respect to the parameter vector. As a result, both the analytical gradient and Hessian computed by the analytical_derivation option do not match the actual objective function, which includes the moment prior.
If this is an intended feature of the code, it might be worth clarifying it in the reference manual. If not, this may need a correction.