This scenario would be totally satisfactory to the boss but for the fact that the suffering workers fail to suffer in silence. They resent the boss and his family continuing as their usual fat and happy selves, whilst they are starving and freezing, and begin to contemplate assorted radical reorganizations concerning who possesses the widget factory. Imperialism means that if the factory could but sell one widget a year to every Chinese, a billion widgets each year could be sold and the warehouse would never fill up. Trouble with this is that the widget factory in our model is not the only one with a bulging warehouse. There's a widget factory in each country, and each must complete for access and control of these overseas markets.
War is a great emptier of widget warehouses.
If there is a shooting war, the widgets are used up whilst the workers are distracted by the hostilities and do not focus on the boss as the source of their poverty. However, as with all solutions created in this universe, the solution itself becomes a new problem. Overseas markets are limited and eventually they are adsorbing all the widgets that can be produced. And overseas markets eventually industrialize themselves, and begin trying to export their own widgets back to the original capitalist countries, greatly increasing the competition. As long as limited war or preparations for war continues, war fulfills its economic function.