Rule of law is the extent to which codifications of norms regulate society. The establishment of a field of societal management (law) in which societies move away from other forms of rule (traditional, pragmatic, leader-based, etc) towards more predictable behaviour served a number of purposes - by establishing norms theoretically higher than those exercising them it reduced political corruption, it increased the consistency of societal function, and it provided a means for jurispridence to have some democratic input.
This codification has a complex relationship to actual sets of norms in a society. To the extent that society has a single set of norms, the process of codifying them introduces new effective values in society. These new values are the metavalues needed to codify the actual norms effectively - they define the metrics by which the efficacy of the codification is judged as well as the process by which it is constructed. Even when the norms are simple, there is a natural tension between the codified value framework and the norms they represent. Individuals internalise this conflict when they come to value civil society - they recognise that the multivariate good their value system seeks is well served by its alienation from specifics and codification into law. In the theoretical sense where there is universal agreement on the norms, this is generally a simple matter - except with pathologically bizarre value systems (or particularly unusual metavalue systems on legality), the sacrifices entailed by codification are lesser than that of a society without laws. Even in this realm of theory, a situation might arise where they would, with regret, step beyond the bounds of the law when its difference from their actual value system is too great. In such a situation, we still may expect the law to be reasonable - it is not contradictory to accept laws that are the only reasonable legal approach to an issue but also in some circumstances feel a moral obligation to step outside the law (and thus accepting the risk/consequences of doing so). When a law can effectively be made compliant to the metavalues governing legal structure or when all circumstances of a law go against what a theoretical just person would do, these tensions are greatest and should be adjusted.
In practice, societies are not static or monolithic - variations on value systems blending into other value systems exist in society and pose a greater challenge to effective government. The distance between the just person of these subcultures and that of the just person of the value system of the government is a secondary point of natural tension - where the distance in relevant matters is small, there is little challenge to the viability of society as a whole and people will buy into society's structures with little tension. When this distance becomes large, those that hold the particular subculture in question become problematic to the extent that society is organised around consent of the governed. From this we understand that to the extent that buy-in is desirable in society, the state should view as positive that both ensuring that its legal customs remain within the realm of acceptability of the majority of the people and encouraging cultures under its dominion not to stray too far from its enshrined value system. The former may take place through varied means possibly including but not limited to democratic institutions in law. The latter may take place through varied means possibly but not limited to universal public schooling with civics and law as part of the curriculum. For the purposes of my political philosophy, buy-in is important - there are some matters where commitment to other things may take precedent over allowing the simple public will to decide (e.g. the commitment to liberalism, to socialism, and to secularism), but I understand it to be a general necessity to have a certain level of buy-in and a strong public interest to have levels of buy-in beyond that.
It is possible to supplement law to reduce some of these tensions - while it is highly desirable to have codification of law with predictable rules for participants in society, this is not sufficiently similar to the way people think about value issues to provide easy satisfaction - when sufficient numbers of reasonable value conclusions go unexpressed, it becomes difficult for people to identify with the state and its mechanisms and a dangerous cynicism threatens divorce between the values of a culture and those of the state. To bridge that gap, I propose that we divide law into two areas and supplement it with a third entity. The most important and most easily codified value conclusions of a society become moral laws. These typically relate to assault, murder, and other crimes with a strong moral element suitable for such inclusion. For this, all the power of the state is available to punish, deter, and prevent the acts. Second, we have as supplement to moral law community judgement. Institutions for this act to condemn, shame, and (less stringently than matters of law) punish actions that are abhorrent to the community but are difficult to codify. A state may decide to offer an even more limited version (meaning less "hard power" and more "cultural power") of these provisions to specific communities under its rule. Finally, regulatory law serves to advance society's interests in ways that simply provide order and do not necessarily have value significance that rises to the level of morals and ethics.