A quick and dirty solution for now - maybe it may help someone later.
<script type="text/discourse-plugin" version="0.8">
api.onPageChange((url) => {
window.removeEventListener("scroll", saveScroll, {passive: true,});
if (url === "/" || url === "/categories"){
restoreScroll();
window.addEventListener("scroll", saveScroll, {passive: true,});
}
});
function restoreScroll() {
var pos = sessionStorage.getItem("categoriesScrollPosition");
if (pos != 0) {
window.scrollTo(0, pos);
}
}
function saveScroll() {
if (window.scrollY != 0) {
sessionStorage.setItem("categoriesScrollPosition", window.scrollY + 1);
}
}
</script>