Fix backward for pipeline engine (#7787)
The new backward API introduced in #7665 broke the nested backward call
used in the pipeline engine. Tests in unit/checkpoint/test_pipeline.py
hang because of this issue.
This PR fixes the issue by manually setting a flag to properly call
backward hooks.
Signed-off-by: Masahiro Tanaka <mtanaka@anyscale.com>