You really won't get out of protected airspace as long as you are flying the hold using normal-ish procedures at or below the maximum holding airspeed for your altitude.
The maximum leg length for a GPS hold increases with altitude (technically it increases with holding template size, but that increases with altitude, so it's effectively the same). So you wouldn't have a 4 nm hold at 14000 or anything like that. Note the holding pattern at somewhere like AEJ, Buena Vista, CO, which at 16000 is a 10 nm leg length.
Holding pattern evaluation is covered in FAAO 8260.3G, Chapter 16. It's rather tedious to get through, but there are some interesting points. First, right from the beginning it talks about the "buffers" or "allowances" added to holding patterns, such as allowing you to be 15 degrees off course, 6 seconds delays on recognizing you've crossing the holding fix, assumed tailwind scaling from 50 knots at 4000 up to 120 knots at high altitude, etc. There is a LOT of buffer built into holding patterns.
Now, when holding patterns are evaluated, the minimum holding altitude is evaluated first. So, say 3000. If holding works at that altitude, then each even-thousand ft altitude above that is also evaluated at its appropriate template size, up to the maximum holding altitude. Each evaluation at a higher altitude has more protected airspace because the TAS increases, and at 6000 and 14000 the maximum IAS (and therefore TAS) also increases. So GPS holding at 3000 is template 5, which has a maximum leg length of 4 nm. But if the maximum holding altitude is 10000, that is evaluated using template 10, which has a 7 nm max leg length.
However, only the maximum leg length for the minimum published holding altitude is shown on the chart. This makes sense because if (in the example above) you fly a 4 nm pattern, you're definitely going to be safe at all altitudes. You COULD safely go longer up at higher altitudes, but how do you know how far? You don't. This information is not published anywhere, unless you took the time to find the maximum template size from the form 8260-2 for the holding fix and cross-reference that with Table 16-10-1 in FAAO 8260.3G.
Now, I just said you'd be safe, but would you be legal? If the hold is published at 4 nm and you're holding at 10000 and because you read this thread you decide to do 7 nm legs, is that legal? Probably not in my opinion, unless of course you clear it with ATC. But you will not hit any obstacles or mountains.
Several years ago, we started charting maximum holding patterns on HILPTs. If I recall correctly, the impetus for this was the ALS RNAV (GPS) RWY 20, which now has a HILPT charted with min 11300, max 12000. I seem to remember that when the holding above 12000 was evaluated, the template got larger, encountered some higher terrain, and therefore wasn't possible above 12000. Without having the maximum altitude charted, aircraft could come into the HILPT at 14000 or whatever, planning to descend in holding, but under certain conditions this was not safe. So the maximum altitudes were published.
Note that typically, HILPTs (and their somewhat-related, but not really, cousin the Arrival Hold) are the ONLY place maximum holding altitudes are published. They aren't on missed approach holding or enroute holding. And you'll probably see a lot of maximum holding altitudes of 17500 out there, because that's just what we documented in the source forms before there was any requirement to publish them - since in most areas of the country, if it's clear at 3000, it's clear all the way up to Class A.
As I got typing here, I kind of forgot what point I was making. Oh well!