This is the more logical place for the function to live. If/when we factor out a separate class for just the Coordinates themselves, then the definition should be moved to Coordinates::lexOrder (and Element::lexOrder would become a thin wrapper delegating to that function).
This is (tangentially) work towards fixing: https://github.com/llvm/llvm-project/issues/51652
I think technically methods appear before data, but I find what you did not readable as well, so good to go.