Usually one would do tiling. Either to draw only the parts that are currently seen, or to create the tiles and then have a way to stitch them together when creating one huge image at the end. For some example code of how this may be done you can take a look at where Skia tiles in the Viewer test application [0]. This doesn't quite do what you want, since it doesn't actually lazily create the backing for the tiles, but it does show how to break up your drawing into different parts, each of which could be targeted to a separate tile. We do have a few users that have used Skia with their own tiling management for similar reasons (with potentially very large output which doesn't all need to be in memory all the time), so this wouldn't be the first time someone has tried this. There may be other possible solutions as well.
That being said, 45000x45000 in 8bit per channel RGBA is getting up to around 8GB. Note that there is currently a hard limit of INT32_MAX of any given dimension, but it doesn't look like you're running into that.