That is true, but she also had to rely on the spies promise of safety for her family.
Had they not fulfilled their promise concerning the scarlet rope things might have not gone well for them.
God made sure the wall where rope was hanging did not fall, it was up to the spies to keep their promise.............
And later, some Judahite actually married the former prostitute. God’s long-term plans for her required multiple men to play their parts.