The attached test case does not render properly. To see the bug, counters need to be implemented (http://bugzilla.opendarwin.org/show_bug.cgi?id=4980), but I have not yet committed that patch, so this bug is not yet present in the nightlies. I am filing it anyway in anticipation.
Created attachment 10770 [details] Test case
The issue is probably that the ::before elements are not created and therefore not counted.
The reported test case is properly rendered in WebKit r39524.
I am unable to reproduce this bug in Safari 15.6 on macOS 12.5 based on attached test case. From the output, Safari have both lines matched each other similar to what is expected of this test and it matches with other browsers (Chrome Canary 105 and Firefox Nightly 104) as well. I think it might be fixed along the way, can this be marked as "RESOLVED CONFIGURATION CHANGED". Thanks!