On measure 21, Chopin uses a B major-minor chord followed by a D# minor chord. One might think we're in E major and that he's just borrowing the D# minor, but on measure 19,  it seems Chopin has already modulated back to C# minor by preparing us with a iiø V7 like what was in measure 7*. It's clear that he utilizes this D# minor to get to the B# fully diminished seventh in the next measure, but how is this progressions described in functional harmony (B major-minor (or B dominant) -> D# minor -> B# diminished seventh)?

*in the larger harmonic context, measures 21-24 seem to extend and amplify the instability of measures 19-20 to take us back to the home chord of C# in measure 25.