Kind request - custom node - Parts - get original family's CompoundStructure Layer Index

Dear colleagues,

I have a kind request for those knowledgable in Revit API and scripting cutom nodes.

I (and many of us need) a Dynamo node that is fed with Parts entities (made of any built-in family with compound structure) and returning as result their Layer Index number of entities original family’s type that actual part is made of.

Examples. I have a wall with 5 layers (structure). Those layers have index numbers (shown in edit type > structure). Then I make Parts of an instance of this Family Type. Each layer becomes a temporary part entity. I need to know the layer index number of each of those parts that they have in their original families.

From my understanding this would have to do with extracting HostObj > CompoundStructure LayerIndex…

Usage / purpose

Revit makes great schedules of wall,slab,roof etc. Breaking Walls into Parts allow to make a schedule of all layers used for each enclosure with easy sorting/filtering. This list as other schedules retain backward compatiblity, so that you can type materials/comments to each layer in such schedule.
The problem is that such lists of Parts have wrong order if layers/Parts of each Family. I need to sort this list of Family Type layers in correct order. This is imposible to get (by my knowledge) in raw Revit.

By knowing layer index numbers, we can sort these lists and provide a sound solution on monitoring/changing and scheduling all layers of all enclosures that lots of people using Revit need in everyday practice.
My proposed solution would write the index number into some parameter of Parts entities (eg. Comments oraz other Shared Parameter) allowing for Revit schedule sorting.

Then You could just pust one instance of each enclosure on some obscure level, devide it to parts a run the script copying index number to each Part.

Can anybody help me with that?