BLD: Fix IntervalTree build warnings
- [X] closes #27169
- [X] closes #30365
- [X] tests added / passed
- [X] passes `black pandas`
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

xref #30366 
cc @WillAyd 

