How do flight procedure designers decide when to assign an altitude constraint to a waypoint?
Altitude limits on these procedures have to take many different things into account, including obstacle clearance and communication, but also radar coverage, separation from other procedures and airspace, the overall profile of the procedure, noise abatement, and more.

The at or above 2500 restriction on the DEEZZ is similarly included in the other SIDs at KJFK. The main reason could be that the NYPD operates helicopters out of Floyd Bennett Field below that area, and the Jamaica Bay seaplane base is also nearby. Another reason could be to keep aircraft above the approach for runways 4L and 4R, though I'm not sure they would use those at the same time. It could also help noise abatement for the homes and parks in the area.

In the case of the HAWKZ, my guess on the altitude restriction is to keep all the aircraft on those segments at approximately the same altitudes. It seems like an aircraft could be lower than FL220 at PTERA without other issues, but the lower an aircraft descends, the slower it flies, and it would become difficult to work a slower aircraft in with the faster stream of traffic at the higher altitude. This sort of restriction is not uncommon on STARs that begin relatively far out.