One might suppose that “Cubbyhole” had developed from the hole or den in which the young of the bear or fox may be found, but no.
In rural parts of England one may still find places where cub means the shed or pen or stall for cattle, or the coop for chickens, or the hutch for rabbits, or even a monk’s cell.
It is a term, that is, for any small shelter.
The diminutive, used chiefly by children referring to any small retreat of their own, is cubby, frequently extended to cubbyhole.