The scene where ant-man suggests killing baby thanos, they explain that the past is set in stone and you can't change it. Any changes they made to the past won't affect their present, but instead create a divergent timeline. So doing that wouldn't bring back the vanished. Thats why 2014 Nebula and Thanos can die without it affecting anything in the present timeline. It's basically just multiverse theory.