An algorithmic construction of entropies in higher-order nonlinear PDEs