It is an amazing feat, but also makes me wonder why - and why, for instance, Roger and Novak have slipped out of the top 10 during their extended prime, especially considering their overall better health and (especially Novak) their generally greater consistency across surfaces. Roger was in the top 10 for 734 weeks from 2002 to late 2016, the third longest streak; Novak's longest was 555, from 2007 to late 2017, which is 6th longest.
Rafa's low point was in 2015, when he slipped to #10 for a bit. Roger slipped as low as #17 in early 2017, before his Indian Summer surge. Novak was out of the top 10 for the better part of a year, falling to #22 in mid 2018.
Here's the difference, I think. In his worst season (2015), Rafa made up quality with quantity - he played in 23 events that year, the most of his career, so was able to stay in the top 10, despite teetering on the edge with the worst match-per-match performance since before he broke out in 2005.
In Roger's worst season (2016), he not only missed two Slams but only played two Masters and 7 tournaments overall. Novak played a bit more in 2017, but still only 10 events. But his main issue was poor performances at Slams - he went out in the AO in the second round and only reached the QF of Roland Garros and Wimbledon, not playing the USO or World Tour Finals - so he couldn't make up the difference with extra tournaments, playing in only 10.
Meaning, Rafa stayed in the top 10 in 2015 by playing a lot of tournaments. When Roger and Novak had their dips, they played a lot less. If I remember correctly, the reason Rafa played so much in 2015 is that he was coming off a long injury in 2014, and played a lot in the effort to find his form. It really took him two years, until 2017, but it was also a generally quite healthy span - playing 39 tournaments in 2015-16.
Another element is that Rafa has never missed a clay season, and as we all know he's been utterly dominant since 2005. He's missed tournaments within clay season, but has always played RG and at least one of the Masters. Consider that to be in the top 10, you need about 3000-3500 ATP points, which is about his usual haul during clay season. And given that he's won it 14 out of the last 17 years, that's more than half of the points needed to stay in the top 10.
None of this is to take away from Rafa's feat, which is quite impressive. I was just curious as to what lay beneath the surface.