If the SHA were generated by the data in the commit, then Git would know when two commits are the same.
This would solve problems when rebasing and generating commits that are really the same but Git thinks that they are different because they have different SHA’s.
Is this logic correct or am I missing something?
The SHA of a commit includes the parent SHA commit. That’s why it changes when rebasing even if the commit itself doesn’t change – it’s parent changes (because that the whole point of a rebase).