I think you have this a little wrong. They don't say that actual witches died - indeed, the subject of Harry's essay suggests quite the opposite:
Harry moved the tip of his eagle-feather quill down the page, frowning as he looked for something that would help him write his essay, 'Witch-Burning in the Fourteenth Century Was Completely Pointless - discuss.'
The quill paused at the top of a likely-looking paragraph. Harry pushed his round glasses up his nose, moved his torch closer to the book and read:
Non-magic people (more commonly known as Muggles) were particularly afraid of magic in medieval times, but not very good at recognising it. On the rare occasion that they did catch a real witch or wizard, burning had no effect whatsoever. The witch or wizard would perform a basic Flame-Freezing Charm and then pretend to shriek with pain while enjoying a gentle, tickling sensation. Indeed, Wendelin the Weird enjoyed being burnt so much that she allowed herself to be caught no fewer than forty-seven times in various disguises.
Harry Potter and the Prisoner of Azkaban - p.7 - Bloomsbury - Chapter 1, Owl Post
However the magical community was forced into hiding (citation needed) by persecution, so I would argue that they did feel under some threat. As to why, I have a few ideas.
There are many ways to persecute people.
The first thing to think about is that witches and wizards don't seem to be immune to physical injury, theft, the burning of their property, dynamite, cyanide and other poisons, etc., etc. Don't confuse magic - especially the magic of Harry Potter - with omnipotence. And remember there aren't that many magical people, compared to Muggles. Also, think about the children of witches and wizards, who don't have as much magic, or control over it. They're vulnerable, even though magic can explode out of them in life or death situations, yes, they're still very vulnerable to attack.
I mean, if you imagine some kind of magic vs Muggle war, I think the wizards would probably win, because their magic gives them an extraordinary capacity to do harm, as well as resist harm.
However, thinking about these days, Muggles have quite a lot of technology and weaponry. Guns, for example. You could probably use magic to deflect or stop bullets - if you knew you were about to be shot at. But that wouldn't be much use against a sniper, for example. Magic also gives you incredible abilities to be healed - even from horrible physical injuries, with little mess and little fuss. But that's always assuming you've got a chance. Being stabbed or shot in certain areas will still be fatal unless another wizard arrives very quickly.
But yeah, even at the time they went into hiding in the first place, again, the Muggles had plenty of capacity to do them harm. But that doesn't seem to have been what the witches and wizards were most afraid of, since the Muggles went about it in all the wrong ways. I just wanted to undercut any assumption that their magic would be enough to keep them completely safe.
No, it seems more that there are many ways to persecute people, many manifestations of prejudice and hatred. So even if people's attempts to do you harm are more of a minor annoyance - who wants to be a figure of hate and bigotry? Who wants to be hated by their neighbours, unable to find a place in the society around them? Who wants to be the target of abuse and maybe real and serious crimes that magic can't fix - at least, not if you weren't there at the time. I mean, if you go out and your house gets burnt down, it may not be so easy to put it back - even with magic. You could put the fire out with magic if you were there. But if you're away when it happens...
In such a situation, of course it makes sense that they would form their own community. You'd essentially have to conceal your identity anyway. Even if nobody could actually harm you, you don't wanna be a figure of hate and fear in your community do you? I mean, it's the same reason Lupin tried to hide he was a werewolf at Hogwarts.
So I think it does make plenty of sense that they would have made the decision to go into hiding back when the Statute of Secrecy was passed - even just because of persecution. It may not have been the right decision, but it's one that is easy enough to make sense of.