It seems like there are a few broad categories of fish, and I can easily substitute any fish of a given category for any other most of the time. The one I'm most familiar with is whitefish: a recipe for cod comes out just as well with halibut or tilapia. Are there other such categories? What are they?
Oh yes. Different people use different categories, no one system is canon, but this bit from Cooking Light is helpful; I wouldn't hesitate to substitute within these categories.
Dark and oil rich: anchovies, bluefin tuna, grey mullet, herring, mackerel (Atlantic, Boston, or King), Salmon, farmed or King (Chinook), sardines, skipjack tuna
White, lean, and firm: Alaska pollock, catfish, grouper, haddock, Pacific cod, Pacific halibut, Pacific rockfish, Pacific sand dab & sole, striped bass (wild and hybrid), swordfish
Medium color and oil rich: amberjack, Arctic char, Coho salmon, Hawaiian kampachi, mahimahi, paddlefish, pompano, Sockeye Salmon, wahoo, yellowfin tuna
White, lean, and flaky: Atlantic croaker, black sea bass, branzino, flounder, rainbow smelt, red snapper, tilapia, rainbow trout, weakfish (sea trout), whiting
White, firm, and oil rich: Atlantic shad, albacore tuna, California white sea bass, Chilean sea bass, cobia, lake trout, lake whitefish, Pacific escolar, Pacific sablefish, white sturgeon
You mention that you have successfully substituted halibut or tilapia for cod. This list puts tilapia in a different category than the other two. That illustrates that fish species substitution is a fuzzy thing, and a cook shouldn't feel bound by any list. Even within categories, any change in the choice of fish is going to change the final taste of the dish, either slightly or dramatically. That isn't necessarily a bad thing, in fact it can be a very good thing.
Just as an aside, sustainability is a very good reason to substitute one species within a category for another. In the US these are to good sites to help choose a species: Monterey Bay Aquarium; NOAA If anyone knows of good sites that provide good information about other parts of the world, please leave a comment.