Ok… I think is a little ugly, but it works. It will return sorted map.
Biblio data (\data\bibliography.toml)
[[references]]
id = "1"
type = "book"
title = "Book 1"
publisher = "Publisher 1"
[[references.author]]
family = "Author 3"
given = "a1"
[[references.issued]]
year = "1905"
[[references]]
id = "2"
type = "book"
title = "Book 2"
publisher = "Publisher 2"
[[references.author]]
family = "Author 1"
given = "a2"
[[references.issued]]
year = "5091"
[[references]]
id = "3"
type = "book"
title = "Book 3"
publisher = "Publisher 3"
[[references.author]]
family = "Author 2"
given = "a3"
[[references.issued]]
year = "1905"
and the code
{{$k := .Site.Data.bibliography.references}}
{{ range $i, $v := $k }}
{{- if $i -}}{{- end -}}
{{$a := slice .id .title .type .publisher}}
{{$b := .author}}
{{ range $o, $p := $b }}
{{- if $o -}}{{- end -}}
{{$c := slice .family .given}}
{{$d := union $a $c}}
{{$d0 := index $d 0}}
{{$d1 := index $d 1}}
{{$d2 := index $d 2}}
{{$d3 := index $d 3}}
{{$d4 := index $d 4}}
{{$d5 := index $d 5}}
{{$.Scratch.SetInMap "biblio" $d4 (dict "id" $d0 "type" $d1 "family" $d4) }}
{{end}}
{{end}}
{{$.Scratch.GetSortedMapValues "biblio"}}
The clue is to range twice, build a two slice, marge it, and used $.Scratch.SetInMap and $.Scratch.GetSortedMapValues to get the map sorted. All later taken randomly, sort are made with value of $d4.