Some designs are so good they continue to be used actively eg the 1911 or M2. Variants of the original AK-47 are still used, even in Russia(!) where it is considered a superior weapon in urban warfare because it can penetrate cover better than more modern, smaller bullets.
I think the A-10's future potential is unclear. It is theoretically extremely vulnerable to modern anti-air missiles, but the same thing could be said about the Hind helicopter, which was deployed successfully by the RUAF in Syria.
The B-52 design dates back to the 1940s, with the first flight occurring in 1952.
The Air Force is planning to keep those well into the 2040s. I believe one of the current B-52 pilots is the grandson of one of the original pilots.
Not messing with success is often a good plan.
This isn't a case of replacing old tech with new tech, it's a case of the changing realities of war making a short-barreled carbine adequate for most needs. The M4 has been around since 1988, they'd had plenty of time to do the switch if it really were the better weapon.
The M16A2 is the oldest version still in limited use by US armed forces, it's significantly younger than the A-10 which first flew in 1972. This is a 44 year old front line combat aircraft.
PS: They really are different guns. The original version used a 20-round magazine, that's been replaced by a 30-round version. The long range accuracy was improved etc.
The problem where it's to fast to be fuel efficient, to slow to get anywhere. It's got an abysmal mission range, terrible fuel economy, meaningful defense etc etc. Sure, if we where going to face a few thousand 1970 era tanks or supporting huge slow moving infantry lines then it's great. But, we just don't fight those wars.