When looking at a hadith its important one understands the context. The Prophet ﷺ was once describing the rewards of praying in the mosque to a group of companions. The women spoke up, complaining that since young children occupied their time at home, they couldn't always attend https://twitter.com/SAD333Q/status/1335555328792997888
The Prophet then tells them, in consolation that they get the same great reward for praying at home. THAT is the source of this hadith. Not a ruling but a concession. Meant to make things easier for women, not prevent them from going to the masjid.
Denying a woman from the mosque undermines a woman’s ability to make righteous decisions, absurdly indicating that the community needs to make the righteous decisions for them. As though women can’t be trusted to make the pious choice.
The reality that women are servants of Allah and have their own relationships with Allah is completely disregarded. The mosque is a place of succor and communion with the Almighty. And women need that connection just as much men.
As to an actual ruling regarding prayer : The Prophet ﷺ has said : "Do not prevent the women-servants of Allah from going to the mosque".
Sahih Muslim, Kitab-al-Salat, 0886
Sahih Muslim, Kitab-al-Salat, 0886