The Vulkan specification allows a command buffer to be re-executed without re-recording it, if there were no changes made to the resources used by the command buffer, such as VkBuffers, VkImages, and other types of resources.
Does changing the data in the VkDeviceMemory require re-recording of the command buffer?
Is it better to just re-record it anyway?
Will it cause undefined behaviour if I don't?
does changing the data in the VkDeviceMemory require re-recording of the command buffer?
No, but any changes to that memory must be synchronized with accesses to it if there can be a conflict. That is, if the CB is currently executing and you're trying to change data that it could be reading, then you'll need synchronization between these operations.