Looks like Mercurial can change the history just fine using the hg command. You just need to enable it first.
https://book.mercurial-scm.org/read/changing-history.html
Git can also be configured to disable history rewrites.
https://stackoverflow.com/questions/2085871/strategy-for-preventing-or-catching-git-history-rewrite
So the difference between git and hg really just comes down to the defaults.
That’s the same on Git.