The answer is in the man page for git-rebase:
Note that any commits in HEAD which introduce the same textual changes as a commit in HEAD.. are omitted (i.e., a patch already accepted upstream with a different commit message or timestamp will be skipped).
Rebase looks at the textual change, and refuses to replay that commit if it already exists on the branch you’re rebasing onto.