It should be clarified that the likely cause of the problem is not the size, but the number of templates and similar elements on the page. The wiki has much larger pages Long pages - OpenStreetMap Wiki
The problem has even already been discussed on the forum Script error 24
However there doesn’t seem to be any mention of a solution from MediaWiki Lua error: Internal error: The interpreter has terminated with signal "24". on Extension talk:Scribunto/Flow
Well, or simplify the page by removing images and tables (for example, this is done in RU)