A search is presented for massive spin-1 Z' resonances decaying to a top quark and a heavy vector-like top quark partner T. The search is based on a 2.6 fb(-1) sample of proton-proton collisions at 13TeV collected with the CMS detector at the LHC. The analysis is optimized for final states in which the T quark decays to a W boson and a bottom quark. The focus is on all-jet final states in which both the W boson and the top quark decay into quarks that evolve into jets. The decay products of the top quark and of the W boson are assumed to be highly Lorentz-boosted and cannot be reconstructed as separate jets, but are instead reconstructed as merged, wide jets. Techniques for the identification of jet substructure and jet flavour are used to distinguish signal from background events. Several models for Z' bosons decaying to T quarks are excluded at 95% confidence level, with upper limits on the cross section ranging from 0.13 to 10 pb, depending on the chosen hypotheses. This is the first search for a neutral spin-1 heavy resonance decaying to a top quark and a vector-like T quark in the all-hadronic final state.