You can call the L2 RPC byeth_estimateGas method and add L1 Gas returned by estimateL1Gas function.
eth_estimateGas
estimateL1Gas
Total Gas estimated: estimateL1Gas + eth_estimateGas in L2