How to change app store user for pre-installed apps on a Mac?
There isn't an automated way to do that.

You would need to request a new redemption code from Apple for all of the apps. I've seen them grant that for businesses that can prove they purchased the Macs. 

For used Macs, I've generally bought a gift card for the buyer or discounted the selling price to account for the lack of license for the built in apps.

I suppose you could ask for a "do-over" for that Mac to Apple Support if you can't put both accounts in a Family Sharing situation and use the AppleID you want to access "puchases" from another account.