The thing is, it's explained early in the movie that there are bad guys who are entirely computer-generated (the "Agents") and then there are regular people who, when they get shot in the Matrix, die in real life. And those security guards were the latter.
Yet, for some reason it's played so that Neo is totally free from any guilt over killing a bunch of people, instead of just generating a helicopter and grabbing Morpheus from the top floor. You know, like they wind up doing anyway.
Or, if that wasn't an option, instead of walking in with machine guns, show up with canisters of gas that would render everyone unconscious. Sure it wouldn't have looked nearly as awesome as the guns, but at least it wouldn't have felt as wasteful (of both human life and ammo). So at the end of the day the lesson is apparently that it doesn't matter how many civilians you kill as long as you make sure that you look as cool as possible while doing it.
Of course, there's also the rationale that Neo was fighting for the greater good of freeing humanity from the Matrix. And thanks to the sacrifice he forced those security guards to make, their families could now be free to starve in a filthy underground city while being relentlessly pursued by killer robots.