I'm not programmer, but I think that's an almost impossible task. I'm feel good with one change of the workflow for this data; one report for where is the materials are, and another for the take-off without direct links with the spaces.
Maybe you can try the "Materials by Architectural Object" and "Materials Take-off by Category" of the file "Materials Reports.vwx", in the VW 2023 > Libraries > Defaults > Reports_Schedules.
In Take-off, you can add a column for, or change some header with, another material property (from "Materials" in Data Manager), for example: =MATPROPERTYBYNAME("Ref"; 'MaterialCategory'). Currently, I use Category, Name (the key), MaterialProductDescription (this can be equal the component of wall styles, in some cases) and some quantities.
In the VW 2023 > Libraries > Defaults > Reports_Schedules > Architectural Reports.vwx, there is the "Wall Schedule with Components", too. You can add columns with space functions in the header; the return is the contiguous spaces of the wall.
For the gross height of the space, in the "Room Finish Schedule" you can add a column with ='Space'.'11_Gross Height'.