They aren't tossing good guns into a barrel and giving them away. Taxpayers at the local level will bring heat on PD's for just buying new guns over and over. What we are seeing are those departments which have had a fleet of guns in service for over 10-15 years needing to replace them, same as their cruisers. Nobody expects the PD to keep vehicles for 450,000 miles, they break down and become uneconomic to keep using. You replace them wholesale at a time when engines are approaching failure, transmissions are worn and slipping, etc. Guns are no different.
They know because of internal parts needing replacement, like extractors and ejectors, the average number of rounds fired (our advantage as it's usually low,) the amount of wear externally (wrestling on pavement with perps bangs them up,) and also for known advantages with a change in caliber. You put up a contract bid, companies respond, and you make the change.
No different than the computers in the offices. Those are likely obsolete faster, and just as expensive. Nobody is using one that dates back ten years, the programming is no longer supported and new ones won't operate under them.
Guns actually don't change that much. My last purchase was an LEO trade-in, a 4566TSW from Texas, about 20 years old. In some jurisdictions the contract would go right back to S&W, the plant in Houlton would make some more, done.
There's not so much flipping and switching. Consider when the Illinois State Police changed from revolvers to the Model 39. Lots of talk, took decades to get some jurisdictions to change to auto pistols. They had just bought new revolvers and couldn't afford to change until they were worn out. Money doesn't grow on trees despite the taxpayers paying for it.
If it wasn't for tornado money being dumped onto the city, my local metro couldn't afford to fix the curbs and guttering just outside the impact zone. Drove thru it yesterday and it was a maze of closed streets and construction everywhere. Nothing would have happened aside from the typical seal coating every five years.
Changes are being made but I wouldn't count on millions of officers getting new guns in the next year. Hardly. Most will still be carrying the same .40 they did last year, and the year before, and we will see trade ins for a long long time.
If you like cheap guns made from plastic in .40 you will be in high hay. I'm just glad I snatched up one of the last iconic all metal service pistols when they were still cheap.
In .45ACP. A man's caliber, ya know. : )