If $id is not resolved, it is maybe not absolute id.
So therefore it needs to be resolved in the current context of $id, which is assumed to be the page $ID. Therefore it makes sense to use getNS($ID) here.
Do you stuck at a case where the wrong link is returned?
Can you come up with an example to reproduce your case? Thanks!
(See
https://www.dokuwiki.org/namespaces for some examples of allowed relative and absolute id's.)