Why do we care about the number of jobs? We use this as a proxy for individual well being, but having a job is not intrinsically valuable. What matters is that everyone in a society has their needs met.
We should not be optimising the number of jobs but the total output of society, while maintaining an equitable distribution of the said outputs. It may be the case that automation permanently makes some classes of workers unemployed, but with the increased benefits from automation we should still be more than capable of providing for them.