There’s another way to spin the analogy, and I believe that’s closer to what Zelensky had in mind.
Both Russia and Hamas target civilian buildings with rockets. Both recently advanced in a military invasion into the sovereign territory of Ukraine / Israel. Both kidnapped and murdered citizencs. So the analogy is Russia / Hamas vs Ukraine / Israel.
I think it’s a bit weird Zelensky would ally with a country which behaves like Russia from his point of view. I agree he probably might still do it, since he needs the weapons. But given this incentive, I think the alternative analogy becomes far more appealing and convincing.