Here’s a couple links that explain how to unzip and modify the OpenXML file hierarchy of .xlsx and .xlsm files and how to create custom ribbonUI. This should make it possible to access and modify the customUI ribbon via customXMLParts at runtime.
Opening and modifying excel files as zips: https://www.jkp-ads.com/articles/excel2007fileformat02.asp
VBA customUI editor: https://yoursumbuddy.com/ribbon-customui-xml-editor/