This is a copy of solana-labs/solana#30400
Problem
If a stake is delegated, becomes active, and then gets deactivated, the delegation is always present in its StakeState. When splitting from any stake, if it's a StakeState, we check that the delegation doesn't go under 0 at https://github.com/solana-labs/solana/blob/fba990654b5d5a16f3b5f6dfd05ed4fd6129c332/sdk/program/src/stake/state.rs#L553-L555. If that deactivated stake has loads of liquid SOL, it will fail to split, which essentially means we can't correctly split a deactivated stake.
Proposed Solution
When splitting from a deactivated stake, don't take the delegation into account.