If a patient presents to the ER with a drug-overdose which causes a heart attack and the patient dies, he's not coded as a drug overdose as the cause of death. He's coded as a heart attack. He didn't die from the drug overdose. The overdose may have been the contributing factor but he died from the heart attack.
All of the rest of what you wrote is for the chart, not the death certificate as the primary "cause" of death.
close but no cigar. The death certificate has three lines below the primary cause of death for contributing causes. Likely in this case covid would be the first one listed if MI was the actual cause of death