How to use get_pages( ) correctly with ‘child_of’ to replace page with child page

Okay, I’ve solved this. I just needed to replace $query->query_vars['page_id'] with get_queried_object_id() and everything works!

However, I just read Pieter’s response and it appears that indeed, according to the codex, it’s not supposed to work. Weird though, because it IS working. I guess we’ll see if anything breaks…