It doesn’t. People have been doing this without refrigeration for a long time. The above poster did not wash off the buttermilk at the end which would cause it to spoil.
When unrefrigerated, they used copious amounts of salt to keep butter from spoiling. So much so that you'd have to first wash the butter (wash the salt away) before using it.