I’m amusing myself thinking about a giant airbag for a sleeping person. I can’t think how anything like that could work. Airbags in cars work effectively by inflating near instantly in a car crash, cushioning the occupant from the near instantaneous >27G (iirc) deceleration. Seatbelts do this very effectively, especially with the crumple zones of a modern car. An airbag keeps your head from decelerating against the steering wheel. I’d imagine an effective safety mechanism for a bed going at 40mph would be something more akin to a really tight blanket affixed to the bed, which itself was bolted to the floor, to take advantage of the protection of the crumple zones of the vehicle. So basically a cocoon.
Airbags have about 2 feet of "cushion" to catch the driver. A "Bedroom Airbag is going to have more room and time to inflate. Also, I suppose you could strap yourself in. And RVs have a lot more momentum and are inherently safer in crashes, kind of like how schoolbusses don't have seat belts.
As you alluded, you could have a "safety blanket that is normally loose but tightens on impact.
Finally, typically head on crashes are the danger for RV, and the bed is in the back, so that is a gigantic amount of the vehicle to absorb impact and damage.