After the @DMGregory♦ comment I come across this documentation.
So, to have the changes made through the editor API serialized correctly I did change this way:
Undo.RecordObject(gameObjectInScene, "Set reference for itsField.");
gameObjectInScene.itsField = theFieldValue;
So, as #DMGregory pointed out the classes inside the editor folder can not be referenced by classes outside of the editor folder. But the classes inside the editor folder can easily reference classes outside the editor folder. Given all that here is how I solved the issue.
I created a folder named game_editor and moved the RequiredInterfaceAttribute into it. ...