They aren't designed for battle use. They're designed to be used in unusual emergency circumstances. For instance, if they entire crew was disabled or killed while the ship had its shields up. Without the prefixed codes, if another Starfleet ship came along, they would have to fire at the ship in the hopes of battering the shields down and not cause further damage to the ship.
Also, as demonstrated in The Wrath of Khan, they are not general knowledge. It's an ace in the hole for Starfleet if one of their ships is hijacked, especially if the enemy crew doesn't know about them or how to change them.-Cpthunt (talk) 02:10, April 3, 2015 (UTC)
The novels seem to indicate that the Romulan War was started when the Romulans began taking over other starships by remote; prefix codes likely arose after that. 31dot (talk) 11:21, April 3, 2015 (UTC)