I think they are capable of both at the same time. First of all, offense and defense need different equipment. To hold Bakhmut, they need menpower, artillery, drones and anti armor weapons. But to attack, they need most of all MBTs and IFVs to breach russian defenses. Of course you need significant numbers of troops for both, but it seems like a shortage of troops is not a problem so far. There are also thousands ua soldiers in training in many western states right now. I believe Ukraine has enough reserves, especially because they don't throw them into the meat grinder like Russia does. Development of smart tactics together with Nato, western equipment and a good healthcare greatly increase the life expectancy of a soldier. As soon as the western armor arrives, we can expect Ukraine to take the initiative again. It won't be as easy as the last one of course, because even Russians learn through mistakes, but I think they had more than enough time to prepare a good tactic.