When setting the minecraft:player.block_break_speed attribute to 0:
/attribute @p minecraft:player.block_break_speed base set 0
It should not be possible to break any blocks, including blocks that are destroyed instantly (block such as grass or any crops that are broken instantly already work correctly).
However, bamboo can still be destroyed with swords.
Fixed in 25w02a