I didn't manage to get a firefox-specific fix, but I have managed to fix what could've been causing lag for large building counts in general.
I suspect a large part of what might be causing lag on firefox is the rendering of structures, considering the large discrepancy in performance with certain canvas methods across chromium-based browsers and other browsers.
I unfortunately won't be able to fix these caveats without largely reworking how the rendering system works. If I really wanted to I can redo the rendering system from the ground up, but that likely won't solve a lot of problems.