What Mohammed did or said is not relevant here. That Hamas chose to use those specific words in their charter to convey their genocidal intent is. They could have quoted Hitler, or Stalin, or Mao for all I care. Or made up something of their own.
Jihadists and jihadi organizations always rely on Islamic history, writing and tradition because that makes it easier to rile up Muslims on issues that are otherwise irrelevant to them. Otherwise, why the f--- would you chant "from the river to the sea, Palestine shall be free" or taunt Jews with "Khaybar" in a supposed rally in support for Palestine?[1][2] Or, use genocidal language in your charter?
Sam Harris, as quoted in the article above, is right: "People are capable of committing genocide. When they tell us they intend to commit genocide, we should listen." So, when Hamas quotes Mohammed (regardless of the authenticity of the quote), it should be "taken" at "face value."
[1] LILLEY UNLEASHED: Canadian citizens need to denounce Hamas (https://www.youtube.com/watch?v=cGXaZ9Uryis)