I run a Unifi USG-1 router/gateway now but before that I got a used AC1000 router from the thrift store for $5 and loaded OpenWRT on that. I eventually got an Aris modem to replace the Comcrap Gateway because it was messing with the DNS traffic, even when piHole was set as DNS for every machine. So if I were you I would go look at the OpenWRT list of units that will accept their firmware. Pay attention to the hardware revision as well as the model number, it matters.
https://openwrt.org/toh/views/toh_fwdownload
Then head over to a local thrift store or two and see if you can find any for cheep.
There are no “real” alternative OS available for apple devices. You can get some IDE “lite” apps like Visual Code, Python Editor, etc. but these a meant as companions to a PC IDE not meant for compiling, linking, testing, etc. You might be able to trade the old iPad for an old laptop you can put a flavor of Linux on.