Finally, finally had an empire declare war on me outside of special events like the War in Heaven. Turns out all you have to do is not build up a fleet. Oops. It makes sense that AI empires won't try to fight you if they don't think they can win, but it's interesting that it sort of feels like a mechanic for punishing you for not doing well. Don't have a big fleet? Time to lose what you do have, and maybe a lot of systems too!
I guess I was asking for it by only having 20 corvettes in 2300, but at least the AI is as dumb as ever and my fleet was vastly technologically superior. That corvette fleet was overpowering fleets with 10 cruisers and a smattering of destroyers and corvettes. In the end I only temporarily lost one system, which was easily rectified, and lost maybe 5 ships through the whole war. I think the funniest part was in the third war that empire declared on me, where they never even left their borders because my border stations were stronger than their fleets. They sat there until their war exhaustion ramped up to 80% or so, at which point they sent two 6K fleets at one 10K station, except they didn't send them at the same time so the first fleet was pounded into dust, followed by the second fleet when it arrived two months later.
I'd have had a stronger fleet by then if I wasn't sinking all of my minerals into an early science nexus. This is the tallest build I've done yet, and it's punishing trying to get 30K minerals saved up for each stage of the nexus when you're only pulling in ~250 per month. In the end I don't think I beat my previous science nexus record by much. I started building it in ~2305, but I don't think I finished it until about 2335, since I was always short on minerals.
Last time I was held up by unity, keeping me from getting the Galactic Wonders ascension perk until about 2315, so this time I avoided droid colonizing nearby planets. That did work, and I got my perks (and tech) faster, but the minerals from those planets is sorely missed now. I ended up building habitats as soon as I unlocked Voidborne, and I really probably should have put some astro mining bays in them instead of filling them with labs and solar plants...
This is a very interesting optimization problem.