You have a very weird idea of what security guards do. They don't sit in front of the entrance all night, scaring off would-be robbers. They are inside the building, in their booth, probably looking over some monitors. They do not provide a deterrent, they just call the cops if something does happen. Robbers have no clue if they are there or not. The heuristic works fine.
I have a very clear idea of what security guards do and I don't know where you got that I believe they "sit in front of the entrance all night" (which they do very often in South America, by the way, among other locations).
Any "reasonable robber", which means maybe not your early teen looking for some adrenaline or the out-of-their-mind tweakers, knows or checks whether there are any security guards in a building in which they intend to make a robbery.
Well, robbers might in fact know if a particular place has security guards, and they would definitely notice once society replaced them all with rocks.
Where I come from, companies don't waste real estate with monitor rooms for security guards. Instead the monitoring is outsourced, and the security guard has a fixed position and a set number of patrols they need to do.