@Himanshu's answer is what you're looking for if you're just needing an easy flag/field on account to denote it's been through a merge.
I did want to correct what you noted. The entry you see in the UI is, in fact, in the AccountHistory object and you can query that.
Field will be accountMerged and OldValue will contain the name of the account that was ...
MasterRecordId field contains that value. This is from documentation
If this object was deleted as the result of a merge, this field
contains the ID of the record that was kept. If this object was
deleted for any other reason, or has not been deleted, the value is
null. This is a relationship field.