I have made a tentative fix in a `snapshot-backport-safe-version-handling' branch. The diff is pretty minimum and can be see at [1]. PTAL.
[1] https://salsa.debian.org/emacsen-team/dh-elpa/-/compare/master...snapshot-backport-safe-version-handling -- Regards, Xiyue Deng