Deduplicate persistent task get_function_name logic (#8529)
### Description
I noticed this logic was duplicated across `turbo-tasks-memory` and `PersistentTaskType`.
This makes sense as a method on `PersistentTaskType`, so put the logic there, and call it from both places.
### Testing Instructions
```
cargo test -p turbo-tasks test_get_name
```