As
cdbc mentioned using a 'normal' installation of Lazarus (meaning by means of a package manager or some other form of pre-configured package) usually let the original Lazarus source-code end up in restricted directories.
If you want to fiddle with Lazarus' source-code then it is advisable to make a (free from any restriction) standalone installation, preferably created manually by compiling the sources.
This wiki page is a generic page on how to install Lazarus and if clicked f.e. on the Linux link, it'll end up
here, which list instructions for building Lazarus from source (that are specific to Linux but there is much similarity regarding the described step/instructions to be able to almost do the same for/on other platforms. Some of the details, prerequisites, and some other platform specifics differ).
Once you have a standalone installation (don't forget to use the --pcp option with its separated configuration directory in case you have also other Lazarus installation(s)) you can edit the files that you wish to 'fix', and then you should be able to do a rebuild of Lazarus from within Lazarus itself or do a manual build (again) using make.
Be careful though, if you 'fixed' your issue wrongly you could end up with breaking your custom standalone installation, requiring you to take the described steps again. So make sure to backup the files that you modified to that you can easily restore things to a previous state.