Both the top of the sill plate and the ledge need to be insulated to avoid a significant thermal bridge at that point.
Is there a sill gasket or sheet plastic/metal/other under the sill plate? If there is a capillary break material between the foundation and foundation sill the moisture (safely) stays in the masonry/concrete, and the wood is unaffected. If not, moisture from the concrete or masonry will wick into the wood, and the wood needs to dry toward the interior. A couple inches of unfaced EPS is over the top of the sill plate is sufficiently high-permeance to water vapor to not present a problem unless the foundation is chronically wet from poor surface drainage or roof edge splash-back.
Insulating with fiber insulation overlayed with foam board would keep the moisture in the fiber insulation layer, and the wiring staples would be at risk of rusting over time. But when encapsulated in closed cell foam the staples are protected. Can foam is typically 1.5-2lbs per cubic foot density, waterproof, and fairly vapor retardent- even at a half-inch thickness it approaches the vapor retardency of 2" of EPS.
Is "...in the gap..." , referring the hollow cores of a block wall, as in your diagram?
Fiberglass is a lousy choice as core-filler, since it wicks moisture freely from the masonry to the sill plate, and would increase the moisture content of the sill plate. Rock wool is only marginally less wicking, and still not great. It's better to stuff chunks of EPS board in there as filler then squirt expanding foam between the EPS rubble and sill as a sealer, since both EPS and can foam are reasonably good capillary breaks even in thin layers.
Using 1.5" EPS under the joists to insulate the foundation ledge, filling in the gap over the wiring gap with can foam works. When the foam has set, trimming it flush with the top of the EPS & foundation sill would allow you to add another 1.5-2.5 " of EPS of the top of the foundation sill to make the insulation layer continuous. If the insulation isn't continuous the heat leaks is pretty signficant- the t op of the foundation looks like it's on fire during cold weather in an infra-red image, and wintertime moisture adsorption into the sill from the indoor air remains an issue.