If you're willing to switch from YAML to JSON, you could take a look at my JSON::MultiValueOrdered module which preserves the order of hash keys (and also preserves repeated keys).
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name