Towards a renormalization group approach to density functional theory—general formalism and case studies