The Supreme Court in this case was also not basing their opinion on fact, since there actually was jurisprudence about gun control [1]
Also, it doesn't make sense to say laws should perfectly adhere with jurisprudence. Laws are enacted and changed precisely because lawmakers don't like the results the legal framework is giving them up until that point in time. To whit, the Constitution of the United States and the Bill of Rights were enacted because the lawmakers at the time did not enjoy the British legal framework and their 'unwritten constitution' as they now like to call it.
You're expressing an extremely common misconception about the Constitution. The Constitution does not grant you e.g. the right to free speech or the right to bear arms. You already naturally have these rights. The way the Constitution works is to instead restrict what laws the government can pass. The government cannot simply say 'times have changed, we're going to pass laws banning speech and guns' because the Constitution expressly prohibits that.
So instead, if they want to do that, then they would need to amend the Constitution. And that's entirely possible - the process for that is well defined, and it has been done many times. It requires a supermajority vote in both the House and Senate, and then 75% of the US states agreeing to it. It's intentionally designed such that the Constitution will only change when there is overwhelming consensus across all affected groups.
The Supreme Court's role in all of those is exclusively to ensure that laws do not violate the Constitution.
Also, it doesn't make sense to say laws should perfectly adhere with jurisprudence. Laws are enacted and changed precisely because lawmakers don't like the results the legal framework is giving them up until that point in time. To whit, the Constitution of the United States and the Bill of Rights were enacted because the lawmakers at the time did not enjoy the British legal framework and their 'unwritten constitution' as they now like to call it.
[1] https://99percentinvisible.org/episode/fact-checking-the-sup...