What you’re talking about is a self-propelled gun. An SPG is not an MBT. That’s like saying a Baja trophy truck is the same as a McLaren Le Mans endurance prototype are the same because they both have 4 wheels and are fast.
You can use a tank as indirect fire support, but that is absolutely not what they are designed to do, and they aren’t nearly as good at it as dedicated platforms.
And moreover, Israel is fighting in urban environments. Urban environments eat tanks alive. This is stupid on multiple logistical, geopolitical, and ethical levels.
Artillery isn't only indirect fires the category of direct fire artillery exists. Tanks only get eaten alive in urban environments when they're poorly supported. The US has used tanks in urban areas from Hue to Baghdad without problems.
Tanks' primary role is infantry support and for that job they have a big gun. You know what's useful when there's a bunch of guys holed up in a city building, firing at you? A really big gun you can point directly at them and give them hell.