These were almost certainly family members, not strangers. Obviously you would care after your child/father/grandmother if they were infirm regardless of economic system. And even that is far from universal. Indigenous Amazon societies still practice infanticide[1] in times of scarcity or for infants that are infirm.
[1] https://www.scielo.br/j/csp/a/kPn9cHW4RWKz94CjxDBw3ds/?forma...