Because someone needs to challenge the law and pre-Bruen court acted like the 2A didn't exist.
You mean, before Bruen the court acted like that first clause of the 2A was more than just flavor text.
I refer you to this thread[1] of dozens of sources that show the only pre-20th century view is the individual right view consistent with Heller, McDonald, and Bruen.