Paul's letters are not all in the Bible, so we don't have a full picture of why he wrote what he did. It is very likely, going by context, that there was an issue with the women in that particular congregation, like with other corrections and admonitions in his letters, that didn't make it a blanket rule for all congregations.
It's also very possible that these anti women verses were added at a much later date, and not by the original writer at all.
Beroean Voices channel on YouTube has been an eye opener for me regarding the history, accuracy and origin of the NT.
'All scripture is inspired of God' was written before the NT even existed, what we have now, is what the Catholic Church deemed 'holy scripture' in the 3rd century. And they had no original writings to go on, only copies. Copies full of mistakes, damaged and marginal notes of which no one knows if they were in the original or added afterwards.
Makes we wonder what they kept hidden in the Vatican vaults?