One critical reason for those guards all around NYC is because the housing safety laws mandate them for all residences in which children under a certain age(I believe it was below the age of 12…but not sure) are residents. Failing to do so will result in legal sanctions and serious liability on the landlord’s/homeowner’s part.
My last few apartments in the NYC area didn’t have them because the last residents living there had no children and the buildings tend to be populated mostly by residents without children.