It can be seen from this figure that the previous barracks only occupied four cells, so it can be modified according to the idea of my post:
Please open the building size to choose freely! - Age of Empires IV / IV - Discussion - Age of Empires Forum