Yes in principle this will work.
Just to be clear here is a step through the function:
This assumes that your object 'json', that you are passing to the function already includes the value for json.country.
This line:
dataLayer.push({'event': 'ipEvent', 'ipCountry': json.country});
is updating the dataLayer object with key value pairs event: 'ipEvent' and ipCountry with the value of json.country.
The line:
fetch('/myreceivedcountrycode.php?country=' + json.country)
is making a get request to the url /myreceivedcountrycode.php?country=' + json.country
Note that you are not reading anything from the dataLayer object your are only assign key/value pairs to it.
If this is what you wanted to achieve it should work.
One final caveat, by concatenating the value of json.country to the end of the the url one runs the risk that that value contains characters that are not acceptable for url encoding. Now in your specific case, I assume, the values are two letter country codes so it is likely not an issue, but if it may be an issue you would need to handle that exception/case.