Look, this isn't that difficult. If God want's to make an exception to His Sabbath law (an exception that He clearly defines in His law so as to prevent mischief on our part) such as allowing priests to perform their work of intercession on Sabbath, that's His business.
moreover - by putting the example of the requirements of the laws concerning the work of the temple superseding the commandment not to work on the sabbath, together with the example of David & his men being fed with what was unlawful for them to eat, He is calling these two things "identical" in a sense - they are both examples of the same thing He is teaching them. there is a congruency between them. David eating shewbread is equivalent to priests working in the temple on sabbath is equivalent to His disciples threshing individual heads of grain in their hands on sabbath. that's why He gives them both.
so if He brings up David as an example of sin, then the priests obeying the laws He gave them for the temple is sin, and the disciples picking and shucking grain is sin. but He says, "you would not have condemned the innocent" if you had understood these things.
so if His disciples preparing and eating grain is not sin, neither is the priest doing work in the temple on sabbath sin, and neither is Ahimelek feeding shewbread to David & his men, sin. His disciples were innocent for the same reason the priest who does work in the temple on sabbath is innocent, and for the same reason that Ahimelek was innocent feeding David holy food meant only for the priests & giving him the sword of Goliath.
unless you think God is inconsistent? that He speaks haphazardly with little to no connection between His words?
i do not think He is. i think everything He says here is perfect, linked, concise, and amazing. He has taught them something - given them a key to understanding what desiring mercy rather than sacrifice means. He declares to them that He is greater than the temple and Lord over the sabbath, and both these examples are to this point