Because the landlord knew exactly what they were doing when they rented the apartment to Grandma. If the landlord didn't want to enter into a contract the involving rent control, they shouldn't have been in the business of renting NYC apartments.
I believe the landlord is bound by the language of the law, not the contract. If the law enabling grandma's rent control were fully repealed, there'd be no rent control-related reason the landlord couldn't raise Grandma's rent to market rent. Basically, Grandma AND the landlord both needed to know what they were getting in to.
Grandma: "I want this apartment."
Landlord: "OK, it's $250/month with rent control. But just so you know, if they ever repeal that law, and market rate is more than the $250/month you're paying, I'm raising you rent."
Grandma: "Understood. If I were the landlord, I'd raise the rent on the grandma renting my apartment, too."