I ran into this bug while using the 'Edit element order in creative tabs' button.
After reorganizing a couple of items & clicking on the 'Save layout' button, I got a bunch of build errors with an element with locked code. After clicking on the error message, it opened up the Cactus Living entity element, and I discovered that all changes I had made manually had been undone and all imports had been deleted, despite having the element locked.
I have provided my full workspace since I was unable to recreate the bug in a minimal workspace. The element with the errors is the Cactus living entity and the errors that you will get are the build errors that happened after trying to reorganize the creative tab.
Did you by any chance use git with another person when you did this?