Does FileVault protect against ransomware?
Ransomware works by selecting certain files (normally by type - like docs, bitcoin wallets, etc), encrypting those individual files and forcing you to pay up for a key to decrypt them.

FileVault protects your data on your Mac by encrypting the whole disk. When you boot up your Mac, you put in a password that effectively "decrypts" the drive and allows it to run as-is. That said, once you've put the key in the lock, so to speak, FileVault wouldn't be protecting you from ransomware. You'd still be just as vulnerable as the ransomware would be running after FileVault had been unlocked.

As for the Time Machine backups, this is more complicated. Those backups are stored encrypted at rest, and only decrypted when they're accessed. This means the files inside the backups themselves would not be individually identifiable to ransomware that was running - however the entire backup could be. So the ransomware could encrypt the whole thing as a unit, instead of just the individual files.

As for OSX's "trusted sources" setting, there have been multiple exploits against this feature as of late and it's not as trustworthy as it seems. I couldn't say for certain it wouldn't protect you, but I wouldn't count on it.

I'd recommend some kind of cloud-based or off-computer backup if you really want to protect your data running through a third party application. In other words, don't connect to a network share and backup your data there, use an application to do it. It's unlikely that ransomware would be sophisticated and specific enough to know about specific backup applications, how they connect to their third party service, and how to encrypt the files on that service. Dropbox is a simple example here if you pay for their cloud backup service -- even if the ransomware did encrypt your files in Dropbox, they keep versions backed up so you'd have something to revert to.