Yes, the order is important
Bonus action (PHB p.189)
You choose when to take a bonus action during your turn, unless the bonus action's timing is specified, and anything that deprives you of your ability to take actions also prevents you from taking a bonus action.
Crossbow Expert (PHB p.165)
When you use the attack action and use a one handed weapon, you can use a bonus action to attack with a loaded hand crossbow you carry.
While this is perhaps not as clear as it could be, the order is implicit in the logic of the description: When you take the attack option (this must happen first for the condition to be satisfied) you can use a bonus action (therefore this must happen after taking the action).
It would perhaps be better if it had been written: "then you can use a bonus action", but omitting the "then" does not change the fact that there is a when condition.
To make it clearer here are examples one where the order is specifically not constrained and one using the same wording as the Crossbow Expert feat which gives an explicit example of its use.
First: Shield Master (PHB p. 170)
If you take the Attack action on your turn, you can use a bonus action to try to shove a creature within 5 feet of you with your shield.
This uses specific language to make it clear that the triggering condition of an Attack action allows you to have the bonus action available anywhere on your turn. If you shove with a bonus action first, you are constrained to take an Attack action later in your turn. That is not the language used in Crossbow Expert.
Second: Martial arts (PHB p.78):
When you use the Attack action with an unarmed strike or a monk weapon on your turn, you can make one unarmed strike as a bonus action. For example, if you take the Attack action and attack with a quarter-staff, you can also make an unarmed strike as a bonus action, assuming you haven't already taken a bonus action this turn.
This uses the same language as the Crossbow Expert feat and outlines how it works with an example where you have to make the attack, in this case with a quarter-staff as it is a monk weapon, for the condition to be triggered. You have to use the action.
The language is clear that the availability of the bonus action is triggered when you actually use your Attack action, not when you nebulously declare that you are going to use it.
On a practical level the order is important as, for example, if you use a bonus action to shoot a crossbow bolt and then as a reaction (perhaps triggered as an AOO because of a move) someone hits you and puts you down you never get to use your action that triggered the use of the bonus action, so it should never have happened. The whole thing becomes invalid after the event which is a RAW paradox.
There are related questions and answers here and here though neither answer this specific point they provide some context.