As a one-line rule, my understanding is that the database cannot be updated once a game has been loaded. I have not delved into Lua-based modding, which I understand is the way to make the most 'dynamic' changes mid-game, but I think these functions are still limited to reading from the existing database.
Now, I'm definitely not an expert when it comes to the boundaries of what is possible, but in this scenario - and it's not something I've considered, until composing this reply - I would expect the limitation is imposed because the leader (actually, the Player) is written to a database that contains the game's configuration at the point a game is started. The moment this happens, the game commits some information to the database - which Player is in slot 1, which Player is in slot 2, etc.
Because there is a database-written action that homes a Player to a slot - and, presumably, there is logic that means the foundation of what makes up a 'Player' comprises a single Leader (which inherits their unique 'things', the civilization they lead and that civilization's unique 'things') - I think that means we arrive at a point where changing the leader, based on some condition being triggered, is not possible.
Hypothetically, if it was possible for one Player to consist of multiple leaders, then additional database entries that describe the various conditions that 'select' the active leader at a given time may be achievable - but I daresay this would involve substantial re-work of the