Halliday & Matthiessen (2014: 496):
In all the examples that have been discussed so far, the embedded clause functions as Postmodifier. It was pointed out in Chapter 6 that there are structures in which the Head is fused with the relative element in the embedded clause: this happens with what, meaning ‘that which’, and with whoever, whatever, whichever meaning ‘anyone who, anything that/which’, as in what we want ‘the thing + that we want’, whoever gets there first ‘anyone/the one + who gets there first’. … The effect of this fusion is that the embedded clause comes to function as Head, although it may be helpful to represent it separately in the analysis (Figure 7-17).
This analysis brings out the fact that such embedded clauses function as nominals rather than as clauses; so they take on the range of roles we find with nominals that (cf. what = that which), s/he (cf. whoever = s/he who), the way (cf. how = the way in which), and so on. This is reflected in forms like the one who.