If I understand your question correctly, you are asking how to persistently compromise a whole domain with XSS, and not just a single page, to be able to execute malicious code in every page at any time.
Suppose you have one page,
vulnerable-page.php, where you can inject JS code persistently, that is, every time a user loads the page the malicious code will be executed. If the victim visits
non-vulnerable-page.php though, your code won't be loaded. There might be some tricks you can use anyway, for example you can make
vulnerable-page.php look and behave like
non-vulnerable-page.php, so the victim will think they are on
non-vulnerable-page.php while in reality they are still on the vulnerable page. You could even expand this concept and devise a kind of front-end proxy, so that the victim will think they are browsing the website, while in reality they are always staying on the vulnerable page (the vulnerable page will load the content of the other pages with AJAX, and maybe also change the path in the address bar). You can use similar clever tricks to obtain the information you want, but your mileage may vary.
Now suppose you find a stored XSS vulnerability in the footer of a website, and that footer is included in every page: home page, articles, login page, admin panel, etc. In this case you will be able to inject your code everywhere all the time, and therefore execute any JS you want, wherever and whenever you want.
In several cases though, an attacker doesn't need to be able use XSS in every page to be able to compromise a website completely. For example, the attacker can make a logged-in admin visit a single compromised page on the website: that page might send an AJAX request to change the attacker's privileges (upgrading the account from "guest" to "admin"), and from that point on the attacker will just be able to do whatever they want from the admin panel (including installing malicious modules, changing files, etc.). This is just an example to show you that often a single vulnerable page can still lead to complete compromise.