After Zohran Mamdani’s performance in the New York City mayoral primary, Republicans and suburban Democrats attacked him, and party leaders seemed to be hedging their bets.