There's a number of things going on here:
1) The South China sea dispute is getting more and more dangerous. Japan wants flexibility in making alliances to counterbalance China in that area.
2) This give Japan the ability to deploy troops (or more likely aircraft) to the Middle East in support of US operations there. That likely to happen in return for more active US support in the South China Sea.
3) There is always the North Korean factor. That really defies any sensible analysis, but one can imagine circumstances where Japan would like to use military forces against NK.
It's true that the TPP is seen in the Asia-Pacific as an anti-China move, but it seems a comparatively minor part in this particular change in Japan's military stance.