Not just in children, I'm pretty sure that everybody's "threat detector" perceives "male" and "male with a child" completely differently.
I think you're partially correct about the "bad person wouldn't have a child" stereotype, but it's also about the context. Some bad people will have children, but in their presence are likely to be risk-averse and prioritize peace and safety of their offspring. A father away from their child can OTOH get aggressive.