For Babar all depends upon how many matches Pak plays in next 10 years. Considering average number of test which Pak plays Babar should have played around 95-100 tests (26 tests currently) by the time he is 35. If his averages above 50 after 95-100 tests even then I think he would have to push towards playing till 38 to get 10,000 runs. If he averages in mid 50s then thats another matter.
In ODIs, unless ODIs are not played as much going forward he should be able to get to that 10,000 runs mark. Pak is hasnt played any ODI in 2020 and other teams havent played much as well probably because initially it was meant to be an year of World T20.
Coming to Imam, he has had a tremendous start to his ODI career. If he can increase his range a bit he will remain in the ODI setup of Pak for a long time as well. Other than few technical problems which are rectifiable he has the potential to be a good test opener as well. If he keeps on playing and improving he can get to 7000+ ODI runs. In tests he has to first establish himself only then we can predict anything.
Again nothing is constant, it all depends upon how both of them keep on progressing and how many matches Pak plays in Tests and ODIs in next 10 years or so.