Split out recursive namespace traversal
This is part of &5296 (closed) where we are replacing the existing recursive Namespace queries with linear queries.
This MR extracts the current Namespace query methods in to their own module. This will put them alongside the replacement queries which will be implemented iteratively going forward.