Repetitive and strong coughing does involve tensing of the abdominal muscles. This means that, in some cases, it is actually possible to strain these muscles, which can lead to pain with more coughing, yawning, and other similar movements like those you are describing.
I would suggest that you go see your primary care doctor
about this issue, especially if it is persistent or worsening. The first thing they will do is examine your abdomen, looking for areas of tenderness or swelling in the abdominal muscles. With this examination, they can also rule out that the pain is actually coming from inside the abdomen (from the intestines, for example) and they can also examine you closely for a hernia which, as you suspected, could be another cause of this pain.
Based on what they find, they will recommend the appropriate treatment. Most cases of simple muscle strain
require only anti inflammatory medications to relieve the pain (although it would also be important to treat the cough, if it is persistent). On the other hand, if a hernia is discovered, that will require surgery, and your primary care doctor can make a referral to a surgeon
for you to get that process started.