Later industrial and marine boilers turned this inside out and sent the water through tubes in the fire like you describe. This can be more efficient (because it's easier to hold high pressure in water tubes than a loco boiler) but only a few locos tried it and it didn't deliver much benefit there - seems to have been hard to make work well in loco format.
Still. The train sometimes stopping mid trip to build up steam was a thing.
They have methods to "make water" by using some of their energy to run some kind of desalination plant. Traditionally, this was a distillation process. Newer ships might have reverse osmosis systems. I don't know which are preferred in military applications. Reverse osmosis is more energy efficient, but I can imagine that distillation may have more reliability under adverse conditions. I could imagine having both for efficiency with fault tolerance...
They would still also have a reservoir to store water for later use. That way, all the available thermal power can be directed towards locomotion when necessary. They can make water periodically, when power demands allow it and in a manner that would be most efficient for the equipment.
The desalination may not be perfect either. As I understand it, multiple US Navy ships inadvertently exposed their crews to Agent Orange during the Vietnam war through this process. They were not directly exposed to the chemical like victims on the land. Instead, the run-off from land went into river deltas and contaminated water was drawn in by nearby ships. The chemicals made it through the desalination process and into drinking water supplies.