So far as per my understanding the roll-cage was a means to prevent the roof from caving in in-case of a roll over. If you are thinking on the same lines, think again. After watching some interesting videos and doing some more research, I discovered that a roll-cage serves a lot more in case of modifications on the vehicles whether for off-roading or racing or any motor sports purpose. Most modifications on vehicles also includes removing certain things to lessen the weight of the vehicle keeping in mind the power to rate ratio concept. When these modifications are made the integrity of that vehicle structure can go for a toss. So as per my new learning the roll-cage does prevent the roof for caving in just incase there is a roll-over, but also helps keep the integrity of a vehicles structure which is ripped off certain parts to lighten the vehicle.
Please feel free to discuss further or ask questions if you have more to add or you do not understand the concept so I can explain further.
Thanks for reading.