1. Foam pretty much stymies future welding
2. Not sure what the big picture goal is achieved with foam
3. The unibody pseudo crossmember that you are considering filling, is effectively a big arch, in itself is a beautiful structural solution, but that "arch" requires large immovable abutments at each end, or a lateral member securely tying the two ends together to prevent spreading. The second solution does not exist in your pics. A rollbar with a lower lateral tube somewhat achieves that, OR so does a well designed rear DS safety loop assembly, or just a straight lateral connector attached below the DS, which can also tie in the rear seat/seat belt tie downs more robustly.
4. Best to make sure foam has some flame retardant qualities.
5. Those pics are of two different cars?