Python: How to Save UV Layout With Specific Background Color?
It is not that hard to overwrite the function provide by the module itself (it is still in Python scope):
import io_mesh_uv_layout
from io_mesh_uv_layout.export_uv_png import *

def new_export(filepath, face_data, colors, width, height, opacity):
    offscreen = gpu.types.GPUOffScreen(width, height)
    offscreen.bind()

    try:
        bgl.glClearColor(0.0, 1.0, 0.0, 0.9)  # Here, a green, 0.9 alpha background
        bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
        draw_image(face_data, opacity)

        pixel_data = get_pixel_data_from_current_back_buffer(width, height)
        save_pixels(filepath, pixel_data, width, height)
    finally:
        offscreen.unbind()
        offscreen.free()

io_mesh_uv_layout.export_uv_png.export = new_export  # Directly overwrite it



In your addon, you can provide a color picker(from a color float property) for user. And after updating the value, patch the original export function on the fly. There shouldn't be any tricky part and no performance issue at all.

A more complex method is to modify the uv layout export itself:

Which needs to modify the operator itself, kind of tricky but more flexible to use:
 (Comment included)