Electronically driven spin-reorientation transition of the correlated polar metal Ca$_3$Ru$_2$O$_7$