This is a Lazarus bug that we've already reported, but the team there seems to be ignoring the problem.
See the bug report that was acknowledged as a Lazarus issue by the developers:
https://forum.lazarus.freepascal.org/ind...opic=72963
They basically changed some core code that worked for ages for absolutely no reason (nobody there could tell me why that useless change was necessary). Then when I reported the bug, they changed the code again, thinking the bug had been fixed, but it had not. The 3rd version of the code is also buggy. Instead of restoring the previous working code, they kept the buggy code, again, for absolutely no reason other than "somone with write access to the repo decided that it should be like that". That's the *really bad* face of OSS: nobody is responsible, nobody owns it, it's just a messy pile of code.
Some users manually modify the unit containing the bug, and recompiling Lazarus resolves the problem.
This will only happen when you create a project from scratch. If you copy an existing project and simply rename it, you won't have this problem.
We are working on some type of workaround, but it's not on our top priority list right now (once it's more an annoyance but not a showstopper)