I have no doubt that this will resolve it, but it is 110% a bug in my case. I have a 512GB iPhone, my previous one was also a 512GB model. When I sold it, it had 185GB available, but somehow the restore is hung up saying it is out of space (it shows 79GB available right now, so something is clearly amiss).
So yeah, enabling all these optimize space options will probably make it work, but then I have to go turn them back off again once the restore is complete since if I wanted to rely on the cloud being available all the time I wouldn't spend the money on the larger physical storage.
Maybe in the OP situation they really were close to the limit, but in my situation this is nothing more than yet another software bug to work around.