Yes you can do everything manually.
AFAIK only Cube MX (the GUI editor + code generator) needs explicit support for the CPU type. Obviously it does because it displays the package, the pins, and you can choose what the pins do, etc.
Cube IDE is just an editor + makefile generator.
The "HAL" libs pull in #defines from .h files for the CPU type, so a HAL function for setting some pin state may use different code for different CPUs, and certainly for setting up the clocks, but you don't need to use that code. You can just write it bare-metal from the RM, and probably should do that anyway, although you may use the HAL function as a starting point to save time.
IME, once a product is out, one rarely just changes the CPU. People did this during the covid craziness shortages, replacing STM chips with ESP32 etc, but this is rare. Normally, you archive the old product (PCBs, schematics, code, IDE, the lot) and generate a fresh one.
There is some telemetry in Cube and they ask you if you agree, but I choose No and anyway could not care less. There is no licensing, floating or otherwise. The other day I had a conversation with some EDA vendor about their floating licenses and asked him what I am supposed to do if (when!) their license server stops working. He said I can run my own license server, to enforce the max # of concurrently running copies. Later it turned out that their code is tied to the MAC # of the ETH card in that "server" PC. So if that PC blows up, you are screwed. Unless you bought a spare ETH card, of a type whose MAC # can be user-programmed (most can't but some can) and then you can create a duplicate server.
In the corporate world people pay for this sh*t because they think if they pay they get support (true, to an extent) but nothing is for ever. I had this lesson with $20k Xilinx software many years ago. They simply washed their hands of if when the two dongles eventually broke (they were flimsy) and I carried on when I found a Russian crack for both Viewlogic 4 and XACT 5.
With $$$-licensed products you get this crap. It's a big advantage of free tools to not have that. You can archive a project, perhaps even in a VM (and I actually have that right now, albeit the VM is ~30GB) for ever, for free.
Of course the extent to which this matters depends on whether it is your company, or you just work somewhere. In the former case you have very specific archival and futureproofing requirements. In the latter case, bread on the table at home = bread on the table at home