Hi Rúni,
GetPageIdByNavigationTag requires the Pageview context, as it sends the current AreaId to the method GetPageByNavigationTag, which returns the page object.
You can call that method on your own: Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(AreaId, NavigationTag).
BR, Mario