Chaplains. The original chaplains were added to Roman military and were the official state religion. They're been a staple of warfare since. Their official role is to serve as spiritual and moral support, like a therapist or counselor (particularly before those professions existed). It serves the soldier to have council in difficult times, it serves the state as a proper pep talk helps keeps desertion rates down (with a whole fun new layer of soft power to make the soldier more dedicated to the craft), and it gives the chaplain a fulfilling job.
In America, we have at times pretended that religious diversity is a virtue. Chaplains are less effective if the soldier cannot believe the chaplain shares their values. Thus to keep the tool effective, chaplains and soldiers register their faith beliefs, so that when crisis comes the leaders can pair chaplains in the most effective ways. Add a touch of bureaucracy and you get a list of codes and their associated faiths.
My understanding is that for a long time the list had six options, but in … 2016(?) they decided to get comprehensive and basically tried to document any spiritual/belief structure that a soldier could have. They got ~211. Even at peak usage, there were a good dozen options on the books that didn't have any active practitioners in the military.
Of course, with the current MAGA in charge, all that diversity and inclusion is treated as a waste of taxpayer dollars and thus has to go. Personally, I think chaplain programs should be sunset in favor of said therapists and counselors, but I get why having a lever to shift soldier morality (not constrained by the science underpinning counseling) is simply too useful to let go.