Yes, as I said - if you load a BitmapImage using SetSource~() methods - the UriSource isn't set. The way the method that loads a WB from a BI works is it just uses that UriSource to load the WB from the original source. There is no API unfortunately to
read the pixels out of a BitmapImage (well, maybe not true these days since you can use RenderTargetBitmap and render a BitmapImage to a RenderTargetBitmap and then copy the pixels, but that's also not very efficient and kind of hacky since it requires the
UI to actually be inserted into the visible UI tree).
In your case you would just do a string-replace of all BitmapImage strings in your code to WriteableBitmap and replace the BitmapTransfer.FromBitmapImage() call with a bitmapImage.Copy() call that is using the WriteableBitmapCopyExtensions.Copy() extension
Alternatively you can leave the first paragraph of your code intact and do the following in the second part to load the image again:
var bitmapToSave = new WriteableBitmap(1,1);
Also remember to wrap your "bitmapStream = await this.sharedBitmapStreamRef.OpenReadAsync()" code in a using block to properly close the stream when done with it. That also requires that you replace the SetSource() calls with await SetSourceAsync()
so that the images are actually decoded before you close the stream.
The choice between loading the image again vs copying the pixels of an already existing one should be based on some performance tuning - you'd need to check which one works faster in your scenario.