Bugfix in temporal support: make sure {object,account,sim,...}_changes_between() always returns results in the right order, even if an earlier record was changed later.

Also add a regression test that failed earlier, but now succeeds.