The problem here is that $page->prevListed() returns a page object which cannot be filtered, you can only filter collections. What you can do is pass a collection to hasPrevListed() etc., see docs: $page->hasPrevListed() | Kirby CMS
See also: hasPrevListed() only for pages with toggle field is true