It is not a matter of sacrifice but a matter of repentance. In the book of Yonah the people of Nineveh were forgiven because they sincerely repented. It does not say that Hashem saw their fasting and sackcloth and ashes, but that he saw their deeds and repentance.
In the book of Esther, which occurred after the temple was destroyed and sacrifices could no longer be brought, Hashem saved the Jews because of their repentance and prayers.
While the temple was in existence, Hashem had the prophets tell the people that their sacrifices would not be accepted if they did not repent and act properly.
For if you offer up to Me burnt- offerings and your meal-offerings, I
will not accept [them], and the peace offerings of your fattened
cattle I will not regard.
When sacrifice is possible it is necessary, though useless without repentance (the “broken spirit” and “wounded heart”). When sacrifice is not possible, God forgives those who sincerely repent.
As it says in Atonement in the Absence of Sacrifices?
In the book of Jonah, the people of Nineveh had sinned and G‑d was
going to punish them. When Jonah showed them the error of their ways,
they fasted and prayed, and were forgiven. The same thing happened in
the book of Esther. Living in Persia between the first and second
Temples, they fasted, regretted their sins and were forgiven. These
historical examples clearly show that when there is no Temple, sincere
teshuvah (repentance) is all that G‑d demands.
In fact, this was always part of the system. King Solomon himself, in
his speech dedicating the first Holy Temple, already anticipates the
possibility of Israel being denied access to the holy place: