Quantum-enhanced dark matter detection with in-cavity control: mitigating the Rayleigh curse