whether or when one should need such a function
Any other programming language provides this. So from a UX perspective, as in "what does the user expect to be able to do" it should be there.
Then, a regular use-case would be that persons A and B work on the same script using git and git lfs. "git clone" sets up the workspace. Imagine a file structure
| --- script.R
| --- data/
| --- data.csv
The script should be able to do something like
setwd( system.getCurrentDirectory() )
data <- read.csv(file="data/data.csv")
AFAIK right now A and B will have to maintain a separate launcher script that sets the correct working directory, which is bad, or find-and-replace all absolute paths, which is worse.