The cavity leaves clearance inside while the cover still has to stay flat under bolt load: walls are made uniform and a flat land at the rim takes the O-ring.
Groove and rim come off one operation with a flat groove floor, which is what keeps the joint leak-free.