I make it a point on our planning sessions and reserve a task here and there for things like this.
Or explicitly plan a task to be done in quick& dirty way and acknowledging we will another task to clean it up later.
Works great for me
At a previous startup we had “bug bash Fridays” where we would either let the devs find bug tickets in Jira that they wanted to fix or could self report problems that they had noticed. While most devs don’t seem to enjoy fixing bugs, this was shockingly well received and good for morale.