Access funds on legacy address related to segwit address from which I have private key
I'm afraid you have a bug in your mining software, and your coins are gone.

Instead of sending to the P2SH address, a block was created with a P2PKH output script, reinterpreting the script hash from the P2SH address as a public key hash. This happens somewhere in broken software that doesn't support P2SH and additionally also fails to check the address version byte.

If this is the case, it is unrecoverable and those coins are lost forever. You can't find a public key whose hash matches that script.