I agree Kapil may have been better, but during 90+% of his career there were only WI, Aus, NZ, Pak, Eng, and Ind as proper sides so it was easy to be in the top 25. Kapil could be behind 6 West Indians, 4 Aussies, 3 Poms, 3 Pakistanis, a pair of Kiwis, a couple of other Indians, and a Roy Dias or Duleep Mendis and be easily in the top 25.
During Afridi's career there were gun South African and Sri Lankan batters as well plus some good Zimbabwean ones and Bangladeshis and even Irish and Dutch (RTD). Therefore, making the top 25 was much harder.