I solved the issue.
When I initially encountered the issue, it was because the existing LaTeX installation (TeX Live) had a problem locating or using the “lualatex.fmt” file. This could have been due to a misconfiguration or some missing files in my TeX Live setup.
By installing MiKTeX, I essentially set up a new LaTeX environment on my system. MiKTeX includes all the necessary components, including the “lualatex.fmt” file, and configures them correctly during the installation process. As a result, LaTeX documents can now be typeset using LuaLaTeX without any issues.
In simple terms, the problem was related to a missing or incorrectly configured component in my previous LaTeX setup, and installing MiKTeX provided a fresh and properly configured LaTeX environment, resolving the issue. Now PGFPlotsX works perfectly fine.