Remove one recursive function in TreeEnsemble (#25423)
### Description
TreeEnsemble uses two recursive function causing call stack overflow
when the depth of the tree is too high. This is usually not the case
except when nodes are multiplied to represent member ship rule as a
chain of equal.
Fixed issues #25400.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Dmitri Smirnov <dmitrism@microsoft.com>