True, but a producer who doesn't consume (and can be switched off) is not a problem. Retirees are the problem, because effectively they do not produce anything, but they do consume stuff, so once they retire they act as a resource sink. As the % of your population who are not doing anything useful increases then productivity per person drops.
If your economy and population grows consistently you have more workers than retirees by a wide enough margin that you can afford all the dead weight which is where most western nations have been since WW2.
In places with below replacement fertility and no immigration you would get negative growth as your productive citizens stopped working and retired, and are not replaced.
So you add robot workers to bring productivity back up to the point where you can support your elderly population in the style to which they have become accustomed, while also serving the needs of your working population. Your productivity per person is flatish through this period but your productivity per working person is increasing as automation advances.
If your population stabilises at a lower level, then once it hits that point you have excess productive capacity unused due to the lower demand from consumers. You could just turn off the robots that are not needed, this would probably be good for sustainability!
Unfortunately consumers wants are basically infinite, especially if you can bring costs down, which you can because your nation now has very low labour costs.
If your population starts to grow again, robot numbers can be increased to meet demand, at whatever level it is sitting at and worker numbers will start increasing in 18-24 years or so.
If your population just keeps shrinking then eventually the last couple of workers die of old age (They can't retire, which is their own fault for not having dozens of children), and then all the automated systems break down and the last of the other retires also die.
You just need to keep productivity per person of your country stable or increasing and things will generally be ok because everyone is as well off, or better off than their parents.