What are the repeatedly used structures in 4-character expressions (e.g. chengyu) and what do they mean?
It seems that there are two types of 成语 represented by the same “structure”.

A而B之 could mean “action + action, done to something (third person pronoun)”.

取而代之 means “to take and replace 之 (something that was previously mentioned)”. Compare this to 取代, which simply means “replace”. You could consider 取而代之 a literary form of 取代; using it adds elegance to an otherwise common word. Other examples include 换而言之、敬而远之 and 分而治之.

A而B之 could also mean “adjective + adjective, used to describe something (third person pronoun)”.

堂而皇之 means that something (之) is “wide like a hall and grand like imperial edifices”. Similarly, this can be considered a literary form of 堂皇. I would say 久而久之 has similar characteristics, but note that the 久 is describing a long period of time, instead of the appearance or a quality of an object.