Just personal experience. At some point someone noted that a friendly relationship was supposed to reduce the chance a lord would raid you, but that it actually removed the chance entirely. That fit my own observation, at the time I also tried, as a vassal of the western empire, to just let time pass through an entire war with Battania. Even despite owning part of Battania, and being the closest possible target, I was totally ignored.Kindly show us the relevant section of code or developer quote?
I have however tried being raided in the period between declaring independence and getting a vassal, from someone I believe was a friend, hence he possible caveat.
It may have changed, but my own personal fiefs just never get raided so.. wouldnt know.