I am not so sure McCain is different.
Nothing in the Constitution about considering foreign military bases "US soil". The founders wouldn't have thought so.
The issue came up in connection with Barry Goldwater in 1964. He was born in the territory of Arizona.
The issue was never resolved by legal process. The only argument that appeared to have merit was that the territory was ultimately incorporated in the US. Panama was not.
Even if you were born in New Zealand to two American parents you are a naturalized citizen, and every U.S. military installation is U.S. soil. You are thinking way too hard about this issue. McCain is 100% eligible. I’m not sure about the Obama question, not enough information without a proper birth certificate.