(new theory) Update TheoryDatatypes to the new standard (#4986)