Correct way to filter get_pages() function

If you inspect the code for get_pages() you’ll see it calls $wpdb->get_results($query); which in turn calls $this->query( $query );

In there, there’s a filter:

$query = apply_filters( 'query', $query );

where $query is the full SQL query string, right before it gets executed. Unfortunately, it seems to be the only filter that can do the job you need. Unfortunately because, since all queries pass through that filter, you need to compare with the exact query that you need to modify.

Having said that, perhaps you need to reconsider the choice of pages for storing what you stored? You can create a custom post type for your data, and moving them is just an UPDATE statement run once.