Ordering pages by custom header variable in Twig

Example: I want to find all pages with the tag foobar, but I want to order them alphabetically based on a custom header variable.

Right off the bat, my first try would be the following:

{% for page in taxonomy.findTaxonomy({'tag':'foobar'}).orderBy('header.custom_order') %}

But that returns nothing. Suggestions?

’header.custom_order’ is a string, try header.custom_order Instead?

No cigar. Also, it’s a string in the docs. - This couldn’t possibly refer to the variable in the fetched pages as it would represent a variable itself, even if it’s not declared (then we’d just pass null to the function orderBy, no?)