I don't know if there is a built in way to do this. But you can use this...
func get_all_children(in_node,arr:=[]):
arr.push_back(in_node)
for child in in_node.get_children():
arr = get_all_children(child,arr)
return arr
and call it like..
var all_children = get_all_children(the_node)
"the_node" being the node of which you want to get children of. The returned array will have self included as the first node.
You can make it a static function and put it in a class or singleton so you can call it from anywhere in the project.