I am not sure how we should approach this situation, but I believe that it is going to be gradual and thus should be treated with a gradual process. There shouldn't be any sudden changes to society. I'm writing a book on this and need a solution to the problem.
As societies industrialize, jobs SHIFT (not necessarily disappear) from manual labor fields to more specialized and technical fields. People will simply do what they did during the Industrial Revolution- start aiming towards different fields of employment, gaining further education, or getting specialized training.
Unless we want to stay a backwards country, this is just plain how things go.
Machines will remove the need to work at physically or psychologically dangerous jobs and, if they are declared as public property, the products they produce (like food) can be equally distributed to people, thus removing the need for a human to do a job to live in the first place. And like I said, it will give people the free time for their own pursuits. If machines are growing all of the food necessary to sustain a society, that will allow people to stop working just to survive, and instead focus on achieving their own goals.
Of course, like everything else, there is a limit. Humans have basic needs other than food and water that must be provided for. For example, humans need a sense of purpose. A hedonistic life full of bliss and happiness oddly enough doesn't satisfy most people, since they want to be challenged and feel like they are contributing to the betterment of humanity. Giving all of the challenging work to machines will deprive people of the need to be useful. So while some things, like food, water, and medical care, should definitely be provided by publicly owned machines, things like peacekeeping, politics, social work etc. should all be left to the humans.
If we are giving all of our jobs to machines, we then lose our opportunities to work. A small child grows up with a dream in their heart to farm, but that dream is crushed as we replace people with machines. How do we make money? How can we sustain our own lives if we are literally replacing our livelihood with machines? As we lose work, we lose vital skills. We lose the desire/knowledge of how to put in a day's worth of hard work. We become a lazy and lax people. At that point, we are not self sustaining. We are merely taken care of, with no form of sustaining ourselves.