[DeepCompile] Fix staticmethod handling on Python 3.9 (#8240)
## Description
DeepCompile retrieves PyTorch's compiled backward hooks directly from
the class namespace. On Python 3.9, this returns a `staticmethod`
descriptor that cannot be
called directly, resulting in:
```text
TypeError: 'staticmethod' object is not callable
```
This change unwraps the underlying function before DeepSpeed invokes it.
The fix covers both supported implementations:
- PyTorch 2.6: `_backward_prologue`
- PyTorch 2.7+: `_backward_impl`
A regression test emulates Python 3.9's non-callable `staticmethod`
behavior so the failure remains covered when CI runs on newer Python
versions.
## Testing
- `pytest -q tests/unit/compile/test_backend.py
tests/unit/compile/test_zero3_grad_dtype.py`
- `pre-commit run --files deepspeed/compile/patch_compiled_func.py
tests/unit/compile/test_backend.py`
Fixes #7433
Signed-off-by: Vedant Chauhan <staranonymous1011@gmail.com>