OK, here's the folding ladder idea. I thought of this a while back. Basically, one leg would be permanent, affixed between cabin sole and top, the other leg would be hinged on the steps, opening the ladder would fold it down. In the closed position, it would take up minimal space, and could act as a handhold. I've been thinking to orient it so that it was aligned fore and aft (off to one side or the other of the companionway), but an athwartships configuration would work also. The problem with athwartships is that it would either be vertical down from the companionway (not good in a pitching,rocking boat with wet footwear on, I'd imagine), or it would have to be set some distance out from the companionway, into the cabin.
Here's a drawing: