Post-replacement legs will be the crucial factor. The DS and 3DS each sold around 9 million units post-replacement. On the other hand, PS4 only sold around 3 million.
Nintendo's forecast puts them at just under 155 million by the end of this FY, but reaching that mark in practise will be challenging and they don't seem to be pushing hard to make it happen, so to be conservative, let's say they sell 11 million and end up at 152m as of March 2025.
If the successor is expensive, say $450-$500, then the Switch, particularly the Lite, could see a second life next gen as a budget alternative, at least until the Switch 2 Lite arrives, which took 2.5 years with the current Switch.
That could be enough to climb passed 160m.
On the other hand, there is the possibility that Nintendo does a Sony and quickly kills off the Switch in order to shift production capacity and players to the successor as quickly as possible.
The Switch clearly has the potential to top the PS2, it just remains to be seen if Nintendo will let it live long enough for that to happen.