Added a round bale belt to my bed,folds out of the way when not in use. Held on with the bolts that hold the roll bar. Works good for firewood but if you wanted to put just a few small things in it,it would need angle iron on the back corners.
I see no reason you couldn't have 4 solid sides hinged together that would fold in against the cab and out to conform to the rack profile.. maybe just a 90' piece of channel to slip over the corners to keep it from collapsing when in use.