Since you kindly provided the link to the source files, I have downloaded your full Kunena package (6.0 dev.) (for Joomla 4.x.x dev.) just to give it a try and my short conclusion is the following: (well done for this extension, it looks good by the way!)
As I wrote in my first comment I assumed that the problem is caused by the class name of the script file which is at the moment:
class Pkg_KunenaInstaller extends InstallerScript
Then I ran a test within the preflight method of the script file but it did not run at all. Then I changed the script's class name to the following:
And it runs without a problem. So the simple conclusion is: You do not have to/you cannot extend the InstallerScript class in your installer scripts as you did. Probably someone misunderstood or misspelled this at your developer team.
If you extend the base
InstallerScript class correctly as the following then the inherited methods will work and the installer script will run too:
class Pkg_KunenaInstallerScript extends InstallerScript