Keep in mind that anything you "build in permanently" will require you to "crawl around to get to the child if necessary"... If you've ever had a screaming waddler at midnight and had to crawl through that little access hole at the end of the mattress side to console him....... It's much easier to just pull the entire "under mattress guard rail" away from the bed, sit on the edge and rub his back until he's sleeping again, then slip it back under the mattress so he doesn't fall out of bed.......
And, something "permanent" makes it either more difficult or impossible to change sheets on the mattress (unless you have a small helper (like a trained monkey) to tuck in the back side of the sheets.....
2015 F250 6.7l 4x4
2014 Cougar X Lite 27RKS