Among the many frustrations that drove Joe Lonsdale from California, his home state, where he’d made a fortune launching the software company Palantir, was an afternoon seven years ago when his wife returned home shaken and out of breath. She’d taken their toddler for a walk on Market Street in San Francisco’s downtown, he recalled, and had been accosted by a group of homeless people, who screamed at her and the child as they fled.