If you're having a conversation with someone, and you hear: "Il s'avait aimé." ("He had loved himself.") (aimer is used as an example) How would you know that the person didn't say: "Il savait aimer," ("He knew how to love.") instead? They are both logical questions and if there wasn't context, is there any way to differentiate what they said?
If you hear that, then you do not spell it "Il s'avait aimé." and you spell it only "Il savait aimer." (or "Ils savaient aimer.", let's not forget that in the plural there is no difference in the pronunciation). In other words, when you hear that, there is never an ambiguity because "Il s'avait aimé." is incorrect if you think that the form of "aimer" is the past participle; if you think this is so, then the auxiliary can't be "avoir", it must be "être" and that would be "Il s'était aimé.".