How to change Vendor/Product ID when compiling bootloaders

For an Uno, you would need to reprogram the 16u2 firmware, rather than the bootloader.
For a Genuine Nano or other board with an actual FTDI chip, FTDI has a utility to modify the VID/PID/etc in the chip.
I believe you're out-of-luck for anything with a CH340x.
The boards with native USB are easier. Theoretically, the sketch and the bootloader can have different VID/PIDs.