Yes and no. For some jobs in the public sector, that might be true. But teachers, healthcare workers and social workers usually have a more philanthropic motivation. Some jobs can even be quite well paid, like teacher and doctor. However, most people leaving those fields don't do it due to the money but because other working conditions. Shift times, workload in relation to personnel numbers, that kind of stuff. Not that money was no factor, a huge point often is unpaid overtime, but not necessarily the most important and far from the only reason.
And even if wages were the only or the major reason: that wasn't my point. The point is that a significant labour shortage does not only mean that companies have to offer benefits and more money, it also means that people don't get services that are sometimes necessary. Or there might be product shortages in critical fields. Stuff like that. And that might drive up prices.
Or that the workers left are even more exploited and get heavier workloads.