Fixes #34262
getblocktemplate currently asserts when miner.createNewBlock() returns nullptr. This can happen during shutdown or when the mining subsystem is unavailable.
Replace the assertion with proper error handling that returns RPC_CLIENT_NOT_CONNECTED instead, indicating the service is temporarily unavailable.