Theory of the electronic and magnetic structure of cerium pnictides under pressure