Are you using the custom-page plugin?
It seems rbeer fork might fix this, otherwise you have to copy the template manually as leksar says.
Also, if you're talking about hand coding the template in the public directory, those are always deleted on restart. The template in the plugin's template folder is what should be modified.
But I'm also having other issues with custom-pages, so I'm not even sure if that works tbh.
This is the solution that worked for me and no more problem with csrf message.
ln -s /opt/nodebb/node_modules/socket.io-client/dist/socket.io.js /opt/nodebb/node_modules/socket.io-client/socket.io.js
But you will probably have the same problem in the next step