This is a somewhat facetious sentence. The meaning is that for four months, John has been going around every day saying, “I’m going to have finished my novel by tomorrow”, i.e., by the next day, he’ll have his novel all finished.
When ‘tomorrow’ comes and he still hasn’t finished the novel, of course, his statement can be related in indirect speech as, “He said that he was going to have finished his novel by today”.
After a while, someone less than kindly points out that John has now been “going to have finished” his novel “by today” for no less than four months—rather a distant use of the word ‘tomorrow’.
You cannot quite simplify the sentence as “For four months now John has been going to finish his novel by tomorrow”, because of that little preposition by. By indicates here a point in time when a certain action is already in a state of completion (has already been completed). It does not indicate the the time when the action is completed—we would use no preposition at all for that, at least not when the time is an adverb-like word1 like tomorrow or today (or something like at or on for regular nouns).
Thus, if he had said “I’m going to finish my novel tomorrow!”, then he would have been talking about the point in time when the novel is finished, and you could similarly simplify your sentence to “For four months now John has been going to finish his novel today”. But if he originally said that he was going to “have finished my novel by tomorrow” (i.e., he might finish it tonight, or it might not be until tomorrow morning—but when the period tomorrow ends, the book will exist in a state of completed finishedness), and you report this faithfully, then you have little choice but to keep all the (deliberately) heavy and clumsy auxiliaries.
1 Various theories place words like today and tomorrow in different categories: adverbs, noun, determiners, even pronouns. The details are unimportant here, just know that they function a bit different from regular nouns.