I found a solution and it seems like its the correct way to do it.
Disclaimer
Using a texture render target might not be the best approach since generally a render target conveys you’re rendering from the gpu to the gpu. And in this case I’m writing data from the cpu to the gpu. So you might run into some unforseen problems down the line if you take this approach. Probably creating a transient texture is the proper way to do this.
Solution
Dynamically initializing the Render Target's Resource
So first you'll need to initialize your UTextureRenderTarget2D to your desired resolution using this function. Put this where it makes sense.
RenderTarget->InitCustomFormat(2, 2, PF_B8G8R8A8, true);
I'm using a 2x2 image with a BGRA8 pixel format and linear color space for this example
Function to update the Render Target
Then you'll want to place this function somewhere accessible in your code
void UpdateTextureRegion(FTexture2DRHIRef TextureRHI, int32 MipIndex, uint32 NumRegions, FUpdateTextureRegion2D Region, uint32 SrcPitch, uint32 SrcBpp, uint8* SrcData, TFunction<void(uint8* SrcData)> DataCleanupFunc = [](uint8*) {})
{
ENQUEUE_RENDER_COMMAND(UpdateTextureRegionsData)(
[=](FRHICommandListImmediate& RHICmdList)
{
check(TextureRHI.IsValid());
RHIUpdateTexture2D(
TextureRHI,
MipIndex,
Region,
SrcPitch,
SrcData
+ Region.SrcY * SrcPitch
+ Region.SrcX * SrcBpp
);
DataCleanupFunc(SrcData);
});
}
Updating the Render Target
This code will write a red, green, blue, and white
static uint8 rgbw[4 * 4] = {
0, 0, 255, 255,
0, 255, 0, 255,
255, 0, 0, 255,
255, 255, 255, 255
};
auto region = FUpdateTextureRegion2D(0, 0, 0, 0, 2, 2);
UpdateTextureRegion(RenderTarget, 0, 1, region, 2*4, 4, rgbw);
Attach the Render Target to a plane in the editor and it should hopefully look like this when all is said and done

And with that you should have some functioning code to play with.