Trump doesn't understand the importance of national security otherwise he would never have made such a comment. I think he's trying to undermine intelligence officials because he knows they are going to find damaging information about him eventually. He wants to discredit them before they make any findings public, but he's hurting the country in the process.
The American intelligence community is the best in the world. Our capabilities far surpass anyone else. Our closest challenger is probably the Russians, but they are not a match for our resources, technology, manpower, or tradecraft. The American public is aware of only a fraction of a fraction of the benefit the intelligence community has provided to past presidents; Trump would be foolish indeed if he were to underestimate its value.
If the President does not trust our security and crime-fighting organizations then it will lead citizens to not trust them either. This is very irresponsible on the part of Trump and will only lead to problems in the future. All findings by the CIA and FBI need to be taken seriously.
Trump was absolutely right that someone in the intelligence community leaked the dossier. Trump has good reason not to trust his intelligence officials. Perhaps, now that the intelligence community has been caught, they will have to clean up their act. Trump should only trust people that are deserving of trust.