Yes, this is the best way, according to my knowledge. See here for the corresponding macOS versions: Darwin (operating system) - Wikipedia
(FWIW this is not the same as the OS that R was compiled for, which is typically older, that is in R.Version()$os and it might be missing the trailing zero versions, so on arm64 mac and R 4.1.x it is just darwin20.)
sessionInfo() is not reliable because if the R version is older than the macOS version you are running it on, it typically gives wrong results. E.g. these are for the same OS, and they are all mostly wrong, maybe you can consider the last one to be correct:
❯ R-3.4 -q -e 'sessionInfo()$running'
> sessionInfo()$running
[1] "macOS 10.16"
❯ R-4.1 -q -e 'sessionInfo()$running'
> sessionInfo()$running
[1] "macOS Big Sur 10.16"
❯ R-4.2 -q -e 'sessionInfo()$running'
> sessionInfo()$running
[1] "macOS Big Sur/Monterey 10.16"