Layer Name and Layer Arn (the Layer Version Arn without a version suffix) are interchangeable in APIs that require a Layer Name parameter. I understand that you're trying to extract the "LayerName" field returned in the API response in ListLayers, but you can do it more concisely.
If you just need the Layer Arn to call other APIs:
a) You could eliminate steps 1 and 6, and use the Layer Arn value from 5 to call APIs that require a layer name.
b) Alternatively, you could yourself chop off the version number from the Layer Version Arn string(s) in step 4, and skip the GetLayerVersionByArn call in step 5 all together.
If you explicitly require the name, not the Layer Arn:
c) You could parse it right out of the Layer Version Arn yourself.
When it comes to doing your own string manipulation for (b) or (c), there are many ways to skin a cat ... but you could use regex (the pattern is in the API documentation), or split on colons and index the second to last element in the array.
Is it useful to return the Layer Name in more APIs? What is your use-case?