Since the example was given in proto, I'll suggest a solution in proto: add a message option.
extend google.protobuf.MessageOptions {
optional uint64 domain_separator = 1234;
}
message TreeRoot {
option (domain_separator) = 4567;
...
}