fix(pages): use ElggBatch to avoid memory leaks when contructing navigation tree

Uses ElggBatch to reduce the possibility of exhausting allocated memory, fixes $container type check

Fixes #6477