Every once in a while a "fix" like this one comes along. Simple, inexpensive and functional. After seeing your solution, what if you purchase and install two additional stake pockets, and hang the ladder that way.
I would make one suggestion; the gap between the mattress and the bottom of the cross piece should not be greater than 4 inches, allowing for mattress compression in that measurement. That is what safety guidlines are to prevent injury.
Great idea, thanks.