How are the defensive teams for war chosen? The lineup presented for me appears to be randomly selected. It isn’t my chosen defense team nor is it any of my other team formations.
You are able to select your own war team. If you do not, you are unable to participate. However, it is not your standard defense team nor any of your other teams (as you noted). In the alliance tab, you have to go to war. It is there where you select your war team. You can do it on the battlefield (before war starts) or before a war in the war tab. Once a war starts, you cannot change.
There is a reason for this. For alliance wars, you are defending as a team. You may choose a different defending team based on an alliance strategy. This allows you to participate appropriately in the team challenge yet keep your regular defense to guard your watchtower.
The autofill is not very smart. Always arrange your own defence.
If you’re unsure of your best defence, ask your alliance or post your roster on the forum and you’ll get bucket loads of advice