Ok, since I have some spare time, I tried looking how different formations in the game get selected by the AI.

There are four basic formations that are used the most, since they have priority of 2.0:
-"Phalanx attack formation" (used for defense too)
-"Standard formation" (aka single line infantry)
-Special formation for Romans (aka 2-3 rows infantry)
-Formation for light cavalry armies (for Parthian and other cavalry armies)

I tried to debug, in which cases is roman formation used comapred to standard one.

And there are some interesting conclusions I came upon.

Here is for reference roman formation data:

Code:
;****************************************************************
;Standard formation. Infantry line in front, missiles behind
;cav on the wings
;****************************************************************

begin_formation ai_standard_line

	;;; purpose flags
	attack
	defend

	ai_priority			2.0

		; Screen of missile inf
		begin_block 0
			unit_type			missile infantry 1.0
			unit_density		close
			block_formation		line
			block_relative_pos	0 0.0 0.0
			inter_unit_spacing	2.0
			priority			1.0
		end_block

		;; First line of infantry
		begin_block 1
			min_units			3
			unit_type			light infantry 1.0
			unit_type			heavy_pilum_infantry 0.9
			unit_density		close
			block_formation		line
			block_relative_pos	0 0.0 -7.0
			inter_unit_spacing	10.0
			priority			1.0
		end_block

		;; second line of infantry
		begin_block 2
			min_units			3
			unit_type			heavy_pilum_infantry 1.0
			unit_type			light_pilum_infantry 0.9
			unit_density		close
			block_formation		line
			block_relative_pos	1 0.0 -10.0
			inter_unit_spacing	10.0
			priority			1.0
		end_block

		;; 3rd line of infantry
		begin_block 3
			min_units			2
			unit_type			general_unit 1.0
			unit_type			heavy infantry 0.4
			unit_type			spearmen 1.0
			block_formation		line
			block_relative_pos	2 0.0 -10.0
			inter_unit_spacing	10.0
			priority			0.5
		end_block

		;; Archers behind
		begin_block 4
			unit_type			ranged_missile_infantry 1.0
			block_formation		line
			block_relative_pos	3 0.0 -10.0
			inter_unit_spacing	3.0
			priority			1.0
		end_block

		;; artillery and handlers at the back
		begin_block 5
			unit_type			handler				1.0
			unit_type			siege				1.0
			unit_type			any					0.01
			block_formation		line
			block_relative_pos	4 0.0 -20.0
			inter_unit_spacing	2.0
			priority			0.5
		end_block

		begin_dummy_block 6
			spans 1 2 3 4
		end_dummy_block

		;; cavalry on the flanks and back a bit

		;; left flank cav
		begin_block 7
			unit_type			cavalry 1.0
			block_formation		line
			block_relative_pos	6 -5.0 -1.0
			inter_unit_spacing	4.0
			priority			0.5
		end_block

		;; right_flank cav
		begin_block 8
			unit_type			cavalry 1.0
			block_formation		line
			block_relative_pos	6 5.0 -1.0
			inter_unit_spacing	4.0
			priority			0.5
		end_block

		;; left flank missile cav
		begin_block 9
			unit_type			missile cavalry 1.0
			block_formation		line
			block_relative_pos	7 -5.0 0.0
			inter_unit_spacing	4.0
			priority			0.6
		end_block

		;; right_flank missile cav
		begin_block 10
			unit_type			missile cavalry 1.0
			block_formation		line
			block_relative_pos	8 5.0 0.0
			inter_unit_spacing	4.0
			priority			0.6
		end_block


end_formation

Let's check 3rd block and its meaning.
It needs to have at least 2 units, which can be either general, spearmen (Triarii) or heavy infantry (Principes or post Marius legions).

This pretty much means that AI will never select this formation if using mostly Hastati armies.

Also, there is another small problem here, which can be seen by play testing.
And it's that sometimes, if having two or more Triarii, general would be switched to cavalry position on flanks. This is a consequence of having spearmen have same priority as general, making general not always a first choice for this block, leading to having general selected to some of flank cavalry block instead.


So, to fix these two problems here is how 3rd block should be modified (changes in bold):
Code:
		;; 3rd line of infantry
		begin_block 3
			min_units			2
			unit_type			general_unit 1.0
			unit_type			heavy infantry 0.4
			unit_type			spearmen 0.9
			unit_type			light infantry 0.1
			block_formation		line
			block_relative_pos	2 0.0 -10.0
			inter_unit_spacing	10.0
			priority			0.5
		end_block
To prevent getting general on flanks, spear priority is reduced a little, and to be able to get this formation used when having no heavy infantry, light infantry is added to this block with low priority (so it will be used here only if there is nothing better).


I hope this will be helpful to someone.