There are at least three reasons that wouldn't be the case:
1. Platform count is capped, and at a far lower level than fleet cap (plus, the attacker could always jump in multiple fleets in parallel). There's a pretty hard limit (ignoring repeatable techs, which both sides can get) on how strong any one starbase can be, even a citadel + a full array of platforms (even if you count ion cannon, the starbase building for extra platform slots, and the relevant ascension perk). At any point in the game it should be less than a player's mobile fleet (especially a militarist player) can get. Defense platforms could be outright free and still not make it "almost impossible to wage an offensive war"; you'd just have to hit the enemy where/when they didn't expect you so their mobile fleet was elsewhere (and it would certainly be a lot harder to attack effectively, which is why nobody is suggesting something so extreme).
2. Defense platform range is limited, and they can't even get artillery computers or spinal-mount weapons. By the time an fleet has spinal-mount battleships, it can sweep away most platforms (which have mediocre defenses and no evasion, which is the best protection against spinal mounts) before they even get a chance to fire. Because ships of any size above Destroyers will almost always have the advantage in alpha strike, the defender must consider some portion of their platforms to be essentially just ablative armor, and again, platforms have a hard (and fairly low) cap.
3. Platforms are dispersed and cannot concentrate! Suppose you have three choke points to defend (including wormholes, etc. and for now assume the enemy lacks jump drives). If you spend X alloys at each choke point building Y strength of defense platforms (and build no ships) and I spend 2X alloys building 2Y strength of ships, I have only spent 2/3 as much as you but can throw 2Y strength at your defended systems one at a time, and defeat them in detail.
The lack of mobility, evasion, or range, and the hard cap on the number you can have per system, means that platforms should honestly be *more* cost-effective than ships. Why the heck does mounting thrusters and a hyperdrive on a hull make it, in effect, cheaper than an equally-strong stationary platform? That's just bizarre.