[autograd Function] Return input as-is if marked dirty even when requires_grad=False (#91214)
Fixes https://github.com/pytorch/pytorch/issues/90209
Somewhat related: https://github.com/pytorch/pytorch/issues/71119
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91214
Approved by: https://github.com/albanD