Resonator-assisted quantum bath engineering of a flux qubit