Engineering is stressful enough. No need to drive people away faster than necessary. Private criticizing can be delivered directly to offending person, especially if you're a team lead or manager, or it can be delivered to your manager. If it's significant enough to result in actionable items then the situation will be handled one way or another. Meanwhile if the person is capable of resolving the issue after your private criticizing they'll often respect your decision to keep things professional. Heck, sometimes there's an entire bag of worms under the surface like serious family problems they're going through outside of work at that same time that explains their behavior, something you almost certainly wouldn't find out with public criticizing.
I've seen some significant turn arounds from previous team members after some pointed private talks. Alternatively, I've seen people dig in their heals and become a problem team member after improperly timed public shamings.