Squatter's rights are insane but it's actually a pretty complex situation. Imagine you're renting a place and the landlord shows up with the cops and says "this person is a squatter and trespassing and you need to arrest them." And you're like "no, here is a lease." And the owner is like "that's fake and not my signature." Who does the cop believe? Should they be allowed to put you in cuffs if you have some proof you're living there?
The squatter's rights exist so that the police don't have to adjudicate stuff like this in real time with limited information. They say "ok well this person appears to have some legitimate claim to the property so you'll need to have the court sort it out and then we'll do whatever the court says."
Here's the problem -- it can take a month or more to even get a hearing to resolve the situation. In the day of everything being digitized, it should be really easy to record all legal leases with your local government and also to record where your place of residence is. If you don't have that, then see ya. But NYC has nothing close to that is overly protective of "tenants" in all disputes because of how historically terrible slumlords have been in NYC.
The bigger issue with squatters rights is with things like AirBNB in California and places where the law is even more absurd and it's just flat out impossible to evict people in a timely fashion who are "renters" or have some other claim to residence.