Hi, I did some testing.
And my issue is due to the partial page loading mechanism of Modern SharePoint pages.
In some cases the document.title isn't updated correctly when I need it, it still the old value. If you wait few moment, it will be updated with the new version.
So I need to do this in my Application Customizer itself.
Check to following post for more info : https://blog.velingeorgiev.com/page-hit-when-SPA-page-transitioning-modern-sharepoint-sites