The Catholic Church Fathers said that the different gender was due to the Petra being the profession by Peter, whereas the Petros was to designate the man, Peter.
To make the profession establishes a foundation so solid that no one can snatch us from God's hand (to mix two metaphors). The Holy Spirit inspired the use of the masculine and then the feminine so there would be no mistake that it is a foundational thing at issue. Then Jesus immediately gives Peter the keys to the Kingdom.
And every time someone makes that same profession and believes God raised Him from the dead as their Savior, they are added to the 'thing being constructed' during the Church Age 'pause' in the 490 years assigned for God dealing with the Jews specifically. Thus the Church, the Ekklesiaa of believers, is being constructed upon a foundation which Peter illustrated with his profession, and this did not flee from him even though he denied Jesus thrice just a few days later! Peter was added into the construction project upon professing, and since he was the first added, he was given the keys to open the Church Age at Pentecost.
"Petra" means "Rock."
If you're going to use it as a masculine name, it becomes "Petros." Works the same in any gendered language, as shown.
It's "You are Rock, and upon this Rock I will build my Church."
It's as if to say, "You are Slate, and upon this slate I will write my message."
Or "you are Hoss and upon this hoss I will ride to many places."
BTW whether this establishes an "exclusive" Petrine primacy here, is not the point. Im fine with everybody ("Come o-o-o-n-n-n-, everybody!") having a part of Peters mission and his ministry - each according to the gifts God has given him and the situation in which God has placed him.
It's just as we all have a part in Jesus' ministry: we're in Him and He's in us --- and I hope we can say with St. Paul "I live; yet not 'I', but Christ lives in me."
Im just trying to establish something here about how the metaphor works. Peter is obviously not literally a 1,200 pound boulder; nor is the Lord manifestly slapping mortar on his back with a trowel and then layering on bricks to make a literal building with a man immured within it.
Its a double metaphor, then. And it hinges on Petros matching petra.
This is so obvious it's getting embarrassing to keep explaining it.