If you leave or introduce some trivially fixable but noticable flaw in the demo, that will (hopefully) get noticed and everyone can feel that they are doing their jobs without needing to make up something.
But you do touch on a real phenomenon, the Iceberg secret. The solution of which is typically to do mockups with wireframing software:
https://www.joelonsoftware.com/2002/02/13/the-iceberg-secret...
Bugs are more urgent.
Tests and refactoring should be done as part of every ticket and typically don't need to be explicitly called out. This naturally pushes "done" so you don't run out of tickets early.
You'll have a very different experience telling the product owner you spent the whole week working on bugs that they noticed and they told you to fix (even if you left them in originally on purpose) than telling them you spent all week refactoring code. The former is an instant "great!". The latter is gonna get a concerned look and more questions.
The topic wasn't correctly doing development work, but finding ways to slack off while looking good.
I think this is driven more by junior devs still trying to figure out what their job is.