The legs of the loop are slightly smaller in dia for the length that they sit within the frame thickness.
This makes for a small shoulder on the part so it stands firmly on the frame and sits at a predetermined height.
Makes riviting in the replacement easy as the loop will sit at it's correct height on those shoulders against the frame as you gently rivit it into place.
The ends of the legs on the replacements generally have a slight cupped shape to them. This aids in riviting them in place.
The opposing blank holes in the frame are where the riviting punch is placed and allows access to the end of the leg of each to carefully rivit the legs in place.
A flat face punch is all you need to do the work.
Replacement Loops are commonly available from on line sources.
I'm told there are slight differences in the shape betw War time & Post War Loops , the Post War being a bit rounded.
The distance betwe the two posts is the same and either will fit.
A War time loop may be harder to find than the PostWar replacement and may not be a pristine example.
I think the Post War lanyard loop might be alloy instead of steel,,but that's just my guess. Others here would know better.
I can't check my P1 Walther as the lanyard loop is cut off flush with the frame for some reason. I never have had reason to replace it.
Maybe some day.
Added..
Here's a replacement I found with a quick search.
This is a Post War replacement and it does say it is Alloy
But it shows the short smaller dia legs and the cupped ends for riviting
Walther P1 D-Ring Lanyard Loop New, P38, German Surplus, WAL-1952, RTG Parts