I think it is not the pg_dump ordering problem that shows up here (well, maybe that too) but the fact that in PG the function tree_ancestor_keys(varbit, integer) is not restorable. postgresql.sql executes create_tree_ancestor_keys(), so after calling it the function exists and the restore works fine.
Not that this would change anything - psql -f postgresql.sql
does the trick.