The Extendscript method doc.DeleteUndefinedAttribute and the equivalent FDK F_ApiDeleteUndefinedAttribute are not available for a book. There appears to be no other way to delete an undefined attribute or even a normal attribute for that matter. They are available for a document, as discussed in Delete an attribute.
I have used the nomenclature ele.Attributes = changedAttributes a lot. It appears that the Extendscript implementation just goes through and updates any attributes with changed values. It does not remove any, should changedAttributes be one less. 😉
.pop() also appears to be ignored for attributes, in that the attributes length says the same.