@redmuntjac
I recommend you read 'A History of Mindfulness by Bhante Sujato. It is available online for free. If you want a more concise understanding, read the second half. The first half is about building on the research of Ven. YinShun to study the structure of the SN/SA suttas. The second half is on satipaṭṭhāna itself as orignally understood and its evolution.
Briefly, as for satipaṭṭhāna being about developing samādhi, this is just standard noble eightfold path:
‘Sammā sati - Sammā samādhi.’ This a major theme of the History of Mindfulness book though with a lot of detail, so if you’d like to learn more, again, read that. Essentially, satipaṭṭhāna has evolved over time to be understood as an ‘insight’ practice, especially since colonial influences on Buddhism in Burma but also before then in the later exegetical traditions which paved the way.
The conclusion you’ve come to around dhammānupassanā is not far from the same conclusions that we arrive at with comparative historical research into the satipaṭṭhāna sutta(s) themselves. Many people understand it as ‘dhammā’ in the sense of the experience of ‘manas/mano,’ i.e. “ideas,” “mental phemomema,” “thoughts” or “mind object.” While this is somewhat related, it is likely more about understanding the qualities/principles of conditionality that lead one into samādhi, and then develop further to fulfill those same principles/qualities for full awakening. (The same principles that lead to right samādhi lead to full awakening; the principles just have to be developed and then understood). Bhante Sujato translates it as ‘principles,’ others prefer ‘mental qualities’ (Ajahn Brahmali, Ajahn Thanissaro, etc.)
When talking about the six-senses, ‘dhammā’ has the meaning of the sense-experience of the mind. But in the context of the eightfold path, meditation, and mental development, it almost always is used in a different context: the context of ‘wholesome and unwholesome dhammās.’ That is, the principles or qualities which shape the mind and that we work on abandoning or developing. Examples are ‘dispassion (virāga),’ ‘longing (abhijjhā),’ ‘mindfulness (sati),’ etc. And these are usually explained in the context of ‘yoniso manasikārā,’ or wise and rational attention that understands things in terms of the conditional principles of their arising/ceasing/development. This is the same ‘dhamma’ that is in ‘dhammavicaya’ as an awakening factor after mindfulness (sati). There, again, dhamma is also analyzed in more detail in terms of wholesome/unwholesome and yoniso manasikārā. The four satipaṭṭhānā are meant to fulfill the seven awakening factors, so the language surrounding both overlaps quite a bit.
The short of it is that by comparing the different versions of the Satipaṭṭhāna Sutta(s), as well as references in other suttas and even analysis of the sutta which are older than later developments, we can see that dhammānupassanā almost certainly originally contained the seven awakening factors, and likely the five hindrances. Everything else seems to be a later expansion as the sutta became a dumping ground for different practices and frameworks, and ‘dhamma’ is a particularly ripe word because of the evolution of Buddhism towards the Abhidhamma movement and doctrinal categories.
The unique aspect of this section in common across parallels is not like the other applications of mindfulness where one is simply observing phenomena (they know X; they know non-X). Rather, it is described: ‘they know X; they know non-X; they know how X arises; they know how X ceases; and they know how X is to be worked with to result in awakening,’ essentially. So as has been pointed out by Bhante Sujato, Bhikkhu Anālayo, and many others, this section is unique for understanding the principles of the mind that condition and determine the mind in terms of wholesome/unwholesome, and how they arise/cease/evolve.
You can understand satipatthāna as having two wings or sides. One is the side with the observation of body, feelings, and mind. The other is the side with observation of [mental principles]. I think that this is more or less correct and a useful framework. When we arouse, establish, or apply mindfulness, we do so in some domain of the body (say, the breath). Within that domain, various feelings will arise dependent on the domain of the body we are contemplating. And the mind will develop in relation to those feelings, either with a state of greed/aversion or more peace and leaning into samādhi. Dhammānupassanā provides the understanding of the principles behind this so as to lead the mind in the right direction with correct application of mind/attention (yoniso manasikārā). It is what understands the driving principles that lead the mind towards mindfulness of the body, the development of wholesome feelings, and the inclination of the mind-states away from desire/aversion and towards samādhi. So we are not just observing the first three willy-nilly; rather, we are also understanding the principles that drive and evolve the first three to steer us in the right direction. Finally, we can look deeper at these principles and bring them to fruition and full awakening once we have successfully established sammā samādhi.
You can see how this aspect of dhammānupassanā echoes throughout the other three applications of mindfulness, as it is the force behind ‘rid of covetousness and displeasure towards the world’ in the definition of right mindfulness, and it also appears in the Satipaṭṭhāna Sutta as observing the nature of arising, ceasing, and both within each framework. That is, not just observing the body, feelings, or mind, but also understanding and seeing their conditionality via development of the mental principles behind them. While one aspect of it is about understanding the nature of experience in more general terms, such as the conditionality of feeling, I think it could also be about this process within meditation. For example, one sees that the mind is stained by greed. Then they see what principles are driving the greedy mind to arise, and how does it cease. As they become more skilled at this, they understand the nature of the mind in terms of arising and ceasing and can more readily shape the conditions of mind. This is dhammānupassanā, but it’s specifically seeing the dhammas in regards to each particular framework (body, feelings, mind). This is one way of understanding that arising-ceasing refrain, at least.
The last section of ānāpānassati which is said to fulfill dhammānupassanā is contemplating impermanence, + ‘virāga’ ‘nirodha’ and ‘vosagga.’ The seven awakening factors are said to be developed dependent on ‘virāga,’ ‘nirodha,’ and ‘paṭinissagga’ (synonym of ‘vosagga’). So the last step of dhammānupassanā is understanding ‘how the awakening factors are brought to fulfillment,’ and that would be by fully developing all of them up to equanimity (upekkhā) with virāga, nirodha, and paṭinissagga. This is precisely what the Ānāpānassati sutta describes, and it says that the contemplations there fulfill dhammānupassanā because:
Having seen with wisdom the giving up of covetousness and displeasure, they watch over closely with equanimity.
‘Covetousness and displeasure’ are, essentially, the hindrances and unwholesome qualities that drive the mind away from the peace of samādhi and awakening. Note how it says they see their giving up ‘with wisdom,’ i.e. one understands them as conditional mental principles and works with the conditions to remove them. And then they ‘watch over closely with equanimity,’ which is the last of the seven awakening factors. These are brought to fulfillment when the mind uses the awakening factors to incline towards awakening, and this begins with seeing impermanence for dispassion, cessation, and relinquishment.
As for the original thread and how this all fits into kāyagatāsati, I think that kāyagatāsati is basically a term for all four satipaṭṭhānā as a unified practice. It is the turning of mindfulness/sustained recollection and observation inwards towards our experience rather than outwards lost in the world of the senses (incl. the mind). As I said above, when we are mindful of the body, this includes feelings and the state of mind there, and it is motivated and governed by understanding of mental principles (i.e. knowing unwholesome principles as they arise/cease and how to direct the mind in the correct direction of the awakening factors). So this is really all one simultaneous practice, even though it will unfold in a progressive refinement and different aspects can be focused on more at any given time.