I am looking at the same issues Portenta or STM discovery board . I think you could on theory could configure the STM Cube Mx to programme the Portenta. But you would have to reproduce all the pin assignments and settings. And then use an external programmer.
I might be easier to just jump in the the ST cube infrastructure except ST cube is a bit more complex to get going for someone used to programming Arduino. But at least there are lots of examples, documentation and training on the ST website.
I must say I have been testing touchgfx and it looks fantastic. This alone might make it worth switching to the ST discovery cards. It makes really good use of the graphics accelerator.
I think it's early days for the Portenta And the documentation at this stage is somewhat lacking, compared to STs, Sparkfun and Adafruit. The Pro IDE is commingnon fast but still has lots of bugs.
I am still on the fence which way to go with our product development. But for now the ST ecosystem it ahead.