"Malicious", when applied to a computer program, means that it does something you don't want it to do. there's no "malicious" library that gets included in programs like that. You might consider a texting program that can access your pictures malicious.
Any app can request any permissions when it installs, and if you just click OK without thinking, you could be giving it permission to do something you don't want. Or the app could get on the internet, download and install an app that gets root access (just like Kingroot or any other rooting app), then all bets are off - root has access to everything.
As for an app warning you that another app is dangerous, that could be a sales attempt, it could be trying to get you to uninstall an app that's protecting you - anything. If an app can be written to access data, and that's data it's not supposed to be accessing, it's malware. Or it's a file manager running in a rooted phone. The only "protection" is the human brain. Apps can tell you that something is "riskware" or "a PUP" (potentially unwanted program), but only you can decide if it is. (Towel Root, the only way to root an AT&T Note 3, is a PUP. Even though I know what it does, I deliberately installed it, etc. Any time I ran a virus scan on my Note 3s it came up. It was up to me to ignore the warning or uninstall the app.)
Can an app be written that can only access data from one app? Sure. But an app that can access data from any app can also be written. It's 2018. In 1978 we didn't worry about viruses, now we have to, because too many people have too much time on their hands and have nothing better to do than modify someone else's virus. (In 1978, if you could write software, writing it to hurt someone else never came to mind. There were too many things that "no one can do" for us to try to do anyway.)