He had every legal right to talk to the staff of the NSC Counsel's office... in fact, it was his
duty to talk to them and warn them of a potential threat to the national security of the United States, as put forward in
Executive Order 13848:
"I, DONALD J. TRUMP, President of the United States of America, find that the ability of persons located, in whole or in substantial part, outside the United States to interfere in or undermine public confidence in United States elections, including through the unauthorized accessing of election and campaign infrastructure or the covert distribution of propaganda and disinformation, constitutes an unusual and extraordinary threat to the national security and foreign policy of the United States."
By attempting to coerce the Ukrainian Government into launching a baseless investigation into the Bidens founded on a conspiracy theory initiated by Russian intelligence services, President Trump had made himself into a potential accessory to the "covert distribution of propaganda and disinformation". It was imperative that the NSC's Counsel's office was made aware of this "unusual and extraordinary threat to the national security and foreign policy of the United States."