Choosing a PhD field, based on short term or long term decision? I saw already questions regarding field choice, but they do not explicitly answer this question :

Choosing a PhD by following short term interest or following the long term vague idea of what one would like to do or be in the future ?

To explain what I mean, usually choosing a PhD field is restricting, it is harder to keep interdisciplinarity or swap of field if they are not seen as "close". One can be highly motivated by a subject A now but do not see a clear future, contrary to a second subject B a bit less motivating but where future is more predictable.

To take example in my case, I am considering two subfields of Computational Engineering : Physics-based animation in Computer Graphics and FSI in Computational Mechanics as PhD fields. Since one usually considers these two fields quite appart, I do not think I will be able to switch area after the PhD. I am motivated by the former but it is hard to catch a glimpse of future possibilities contrary to the latter because engineering seems more of a "safe" choice considering employment.
By and large, I would recommend you to go with what is more interesting to you right now. As you say yourself, nobody can predict the future, and a vague sense that your specific chosen subfield may go out of style at some point does not seem like a good enough reason to settle for your "second choice" (especially since nobody can guarantee you that the "second choice" will stay relevant).

Further, I think you are overestimating to what extend the topic of your PhD will lock you into a specific field. I have personally switched topics somewhat after my PhD (from distributed systems closer to software engineering), and plenty of other people have done similar switches.

Finally, in cases where a specific topic of research becomes outdated (not uncommon in Computer Science, a buzzword driven field after all), there is usually some sort of "natural progression" for the researchers involved with the topic. That is, professors that used to do a lot of grid computing research 10 years ago now publish on cloud computing, etc.