Modeling the population-level processes of biodiversity gain and loss at geological timescales