If you use a bed rail that goes under the mattress, you'd better screw it to the deck under the mattress. Those rails rely on the weight of the mattress to hold back the baby - bunk mattresses don't weigh anything...
When my guys were little we used these during travel: PeaPod Plus Baby Travel Bed from One Step Ahead | 2U32017
Didn't have a camper back then, but I think they would fit well on top of the bunks. My kids never rolled the pod over, but if you're concerned about that, I think you could secure the high point of the pod to a screw eye on the ceiling. They are extremely compact and set up quickly. The mesh zipper cannot be opened from within the tent.
When my kids were older, we used foam wedges under the bunk mattress to keep the boys from rolling out of the bunks.