Fix the is_leaf check in TreeEnsemble (#25410)
### Description
Fixes #24679.
### Motivation and Context
The original check for a leaf node was insufficient because a branch
child and a leaf child could have the same index. The bug described in
issue #24679 is not a rare occasion; in fact, it is something likely to
be faced in estimators with small and balanced trees. I encountered it
myself in a unit test.
The corrected check ensures that for a node to be considered a leaf,
both of its children must be leaves and share the same index.