Still, I believe earthen barriers are still used to solidify the 'frontlines' if you squint a bit
Afaik the Iraq Iran war was still doing straight up trench warfare (at points) and the Syrian civil war + Afghan theater were using caves (in some areas). Same with Korea and Vietnam.
Then again you're right in that I don't think sudan etc have used trench warfare (in the first civil war, apparently the second one has on a post edit search: https://www.bbc.com/news/world-africa-65962771 )
You're completely right on the second Iraq war, I don't see any sources for trenches, minus hesco.
I think what I comes down to is trench warfare is popular for the same reason earthworks are popular in civil engineering. Cheap, locally sourced, and effective in its purpose.