Hi, Lukasz.
Not sure I understood your use case correctly, but it seems like something that already can be done with dynamic scope custom script. You can manipulate returned claims from there, remove them and add new ones at will. So you could make sure scope A is requested, then search for "family_name" claim, extract its value, remove the claim, and add a new claim with this value called "urn:oid:2.5.4.4"
Does it make sense?