Does it mean that I shall isntall Lazarus 4.0 RC3 and things will work?
I am unable to answer that because I haven't checked yet what might be the culprit nor have I had the time to verify with a RC3 install. In case BGRABitmap package was updated then that might be a reason that the fpgui subpackage does not install properly.
I tried to install bglcontrols.lpk only (one or two days ago, when the first couple of attempts failed), as this is the dependency I need, but I did not succeed.
The other packages, thus including bglcontrols seem to have been installed as intended.
Sorry, this sentence sounds completely Chizneez to me.
I am aware that this is a common phrase to use (I use it myself) but it always makes me wonder what a Chinese person would say when encountering gibberish

Shall some bug be reported somewhere?
The bug(s) are known and are already reported.
If everything goes as planned/intended then it is planned to to be addressed this summer. Until then only workarounds can be used to circumvent issues.
issues:
1. the compiler sometimes wrongfully indicates a unit as being outdated and as a result tries to recompile the unit. If it is a dependency for another unit then this is bale to trigger an avalanche of recompilation.
2. sometimes the compiler is unable to locate the sources correctly therefor unable to recompile the units that requires recompilation.
3. Whenever a unit requires compilation and located in protected space, the compiler is unable to store the output of that compilation back into that directory. Therefor exist a mechanism that stores these compiled results in the user's configuration directory of Lazarus. This mechanism has a flaw that makes it fail.
4. a small additional issue that certain packages and its units needs to be compiled in a particular order. If units and packages get moved around (as is the case with normal development) then the issue might occur that the units are build in the wrong order (devs have tried to tackle that issue but might still occur as not every package or combination could be tested).
Therefor, do not use directories for both FPC and Lazarus for which you do not have enough access rights (e.g. not able to write to) because that triggers one or multiple of the mentioned issues and ends up with errors as reported.
Therefore an installation located at usr/share will fail as you have experienced yourself.
I did my test on a Linux x86-64 install containing a semi-rolling Bookworm, having installed Lazarus 4.0 with fpc 3.2.2 in user space (ramdisk) and except for unchecking the package with fpgui in its name from BGRABitmap did not change anything else.
When I am able to find time and motivation I'll try and see what's up with that fpgui subpackage.
PS: this might all sound very bad but realize that most of these issues only trigger under certain conditions and one issue able to trigger the other (making it also difficult to reproduce and try to fix). There have been very big changes under the hood that we as normal users do not see on the outside so even though undesired sometimes things do not work entirely as intended.