I want to make clear that I've already performed said transactions, so I'm not asking this because I want to do it right now. I'm just curious.
Basically, I've spent a number of very sweaty and nervous days "rearranging" most of my coins so that they will finally end up in an encrypted cold storage wallet.dat, after having spent years fully unencrypted and regularly coming into contact with my main PC. Yes, I know it's insane, but I was not just lazy, but also seriously worried that I'd end up losing access to my coins by forgetting the passphrase. That's why I never did it.
Anyway, I've been forced to pay two Bitcoin transaction fees when sending the coins to myself twice. Although I probably would not have ended doing it if it's complicated/scary, is there some way that I could have just "transferred" the coins by, I don't know, typing some kind of private key dump command in the console of Bitcoin Core and then imported them into the new wallet or something?
Or is the only technical way to move funds between wallets to use the Bitcoin network and thus announce to the world that "somebody sent X BTC"?