Phase transitions in the pseudogap Anderson and Kondo models: Critical dimensions, renormalization group, and local-moment criticality