A UDN user is reporting that the delete_all_material_expressions_in_function Python API does not delete all expressions in one go, but some expressions are left over. Calling the API repeatedly will eventually delete all nodes.
The user also found out that changing the delete_all_material_expressions_in_function implementation to iterate through the array of function expressions backwards solves the issue.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-215725 in the post.