The AExecuteMacroEditor.mm:118 assertion is basically the Execute Macro action editor saying that it cannot find the action associated with it, which is the sort of thing that would go along with your case of the actions being inserted in the wrong place - basically the editor is there, but the macro action behind it is not, which indicates some level of confusion on the editor’s part.
The KMVariables.mm:345 is strange. It indicates it is trying to set a variable to a nil value, and I checked every possible way that code can be executed, and all of them either explicitly have a non-nil value, or actively force the parameter or be non-nil, or assert other previous failings. So other than failing to create trivial strings, which would mean your Mac was fairly badly messed up at that point, I don’t know how this one could happen.
So yes, step one would be Restart, and verify the issue survives that, but after that I don’t really know where to go, since those two failures do not give a lot of indication as to what the problem might be.