Made unpickling test CWD-independent

Refs #24007.
I'm afraid `check_output` doesn't accept the `env` parameter. We'd have to resort to `Popen` for that. Would it be better?