Figured out where the difference is coming from: the syntax differences comes from imported vs internal type references.
The Windows.winmd from the SDK contains everything, including the `Windows.Foundation.Metadata.ContractVersionAttribute` class definitions, and can reference them directly when they are used.
OTOH, the `.winmd` we generate from IDL (and the `.winmd` present in `C:\windows\system32`) are partial, and reference each other or some external classes which are supposed to be later imported from a different `.winmd`.
It is possible to merge / split `.winmd` files using the `mdmerge` .exe utility although it is a bit inconvenient[^1], and after merging our `.winmd` with the attribute definitions the resulting output looks identical as the SDK `Windows.winmd`.
[^1]: I don't know how these attributes can be defined to produce a `.winmd` with their definitions, I had to split the `Windows.Foundation.winmd` to extract them first, then I could merge them with our `.winmd`.