tracing/filter: Change fold_pred function to use walk_pred_tree