I copied my answer for the same OP at https://github.com/godotengine/godot/issues/19473. But this question differs slightly to the original issue report.
In case you want to manually add support for VERTEX_ID, these are the changes I had to make in
spatial shaders. I wanted to use the vertex ID for creating procedural animations.
drivers/gles3/shader_compiler_gles3.cpp in the function
actions[VS::SHADER_SPATIAL].renames["VERTEX_ID"] = "gl_VertexID";
servers/visual/shader_types.cpp in the function
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["VERTEX_ID"] = constt(ShaderLanguage::TYPE_INT);
Then compile the source and it should work. Some other primitives could probably be added in a similar fashion but I have not tested that yet.
One caveat is that the vertex IDs reported by Godot are very different from those reported by other tools such as Blender. This is because vertices are duplicated and in a different order. Godot also only gives you two UV channels to work with. Using UV coordinates also means having a temporal component will require significantly more memory to implement as UVs will typically map sparsely onto a 2D texture, if the data is only used in the vertex shader.
I have a primitive tool working that can map the vertex animation texture generated in blender to one usable by Godot into another grayscale texture (n by 1 texture, where n is number of vertices in Godot). This saves texture memory as no data is duplicated for duplicated vertices. I first need to implement an octree before it will be usable for real-world meshes and not just a set of simple deforming cubes. Once I have that done in my spare time I will release it for free.