Well I think you have some misinformation here. Companies don't give the government back doors into their systems. In some cases the government will subpoena a company for data or a way to access data, but typically the company will and do fight this. All of the methods used by the NSA were based on flaws in the operating system in the case of this latest ransonware there was a flaw in the SMB v1 protocol (remote file access) that the NSA discovered and exploited.
To your other question about perfect security. It doesn't exist and not because companies don't want it, but because it's impossible to account for every possible way a system can be attacked plus the fact that an operating system is millions of lines of code any one of...