From staining on bulkhead looks like it has leaked for quite a while. Definitely looks like end grain balsa core. Since you have the job started dig out the balsa until there is no more black or wet material, air dry the cavity, then whip up some resin with chopped strand, pack it in. You could also prefab a board, maybe a piece of 1/2 or 3/4 plywood 4-6 wide and cut to the opening, fasten a wider strip on the end grain, cover the strip with masking tape or mold release and clamp it in place against the filler. Alternate material would be aluminum channel or square tube, but still needs to be waxed/mold released. It will mold the surface, be better looking if exposed permanently and avoid grinding and filling. Only problem is you probably will need to do front & back first and then the two sides in order to accommodate the clamps.
Filling the void will solidify the bond between the deck and subdeck, and give a solid fastening base as well. You mentioned bolting the hatch- if you are installing a new alloy framed hatch (Lewmar, Bomar, etc.) be careful not to overtighten as it will distort frame. I think they are designed to be screwed in, but for offshore concerns bolting makes sense.
The void between the underside of the deck and the top side of the liner is typical. Once you have finished your new trip should cover the void.
Welcome to the 'other' fun part of sailing