I think that’s a flawed model eg the UN and all of the problems that come along with an oligopoly of force. That and I don’t think city states could accumulate the volume of kinetic weapons necessary to actually defend themselves adequately from militaries like the US, CCP, Germany, Japan, etc.
I think a breakthrough technology has to arise that allows for extreme asymmetrical defense capabilities. Small / cheap / reliable / accurate nuclear weapons and vastly improved missile defense systems could do it potentially.
If NYC could hit 100 population-dense locations anywhere on earth simultaneously with efficient and accurate nuclear armaments 24/7 then NYC could secede from federal / state governments and nothing could do about it. They could do so peacefully but with the ability project power so fiercely that they would be free if they wanted to be.