Fix `ModelCheckpoint` with manual optimization and `every_n_train_steps` (#21239)
* Fix ModelCheckpoint with manual optimization and every_n_train_steps
- Ensure checkpoints reflect the model state before optimization when using manual optimization
- Add warning when pre-optimization state isn't saved
- Update documentation to clarify the behavior with manual optimization
Fixes #20947
* cleanup log after test
* fix future warning with torch.load