Disk Utility changing partition types on its own
The OS X and macOS Disk Utility applications has never been bug free with respect to resizing partitions. The diskutil command has far more options than can be accessed by the Disk Utility application. Also, the diskutil command is less prone to failure. This makes the diskutil command far more versatile than the Disk Utility application. An Ask Different search for FFFF currently results in at least 150 posts, with yours being the latest. The first being posted on August 19, 2012. You refer encountering the problem with Mojave and Catalina, however the problem was first posted when Lion was in use.

Here at Ask Different, the FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF partition type is a known bug. I have no way of knowing for sure, but being this problem has existed for at least 8 years, I just assume the bug is known to Apple.

I best advice I can give you is that if the Disk Utility application is malfunctioning because of the procedure you are using, then you need to change the procedure. I would try to include an alternate procedure, however currently your question does not provide enough information about your current procedure and state of your Mac before applying such procedure.