Pure speculation on my part:
***This idea of an offense in 2023 was probably more driven by the political forces than the actual military commanders.***
Ukraine was under pressure to show results, to show that they are indeed winning and that all this Western aid is accomplishing something.
So, instead of solidifying/hardening a defense they went on the offense, burned up a lot of troops and material, and accomplished little, and most of which was accomplished was soon lost after the offensive ended.
Mr Z, though always in olive drab and combat boots, is no military man. He is a comedian (actor), a political puppet (put in power by us and entirely dependent on us for his survival).
But as said, pure speculation.
Sounds like to me that Ukraine was forced to do the counteroffensive, otherwise the West will cut them off. Which will lead to Russia winning the war.