First, CR 20 is just the extreme example. Running into stuff that can kill you doesn't have to mean CR 20. If could be 8, 10, 12 or whatever. How often that happens is at a minimum several times a campaign, because wandering monster tables don't care about PC level. Beyond that, it depends...