So just some interesting things I have found about this whilst looking for a workaround. The penultimate step (i.e. the last point the data would 'work') is an inner join. If I take this join out and rebuild it then the final step will generate properly. However, if I then save, close and re-open the document then the issue will arise again.
Weirdly, if I run the flow on the two steps that are joined together before I run it on the final step then the final step will work out fine. Further, I have lots of other joins in the flow but this is the only inner join. I tried changing this to a left outer and saving then re-opening but the issue still occurred. This is therefore not a problem with using an inner join. I also tried removing the output step to see if that made a difference to it but same issue again.
In short, I've found a workaround but, as always, there is some bizarre behaviour going on inside Prep. At least a potential solution is provided here if people come across the same issue. Welcoming comments on what the underlying cause is!