Generally, it’s okay to guide a flow with disabling, as long as it's truly absolutely required to do one thing before another (not just good practice or advice). However, it’s even more important to provide the user as much flexibility and fewest modes as you can.
You say the order of the functions is not the issue. Rather, the issue is to ensure the user completes Function X before leaving the page (where “X” is 1, 2, or 3 depending on the context). It’s possible that, unknown to you, it’s very helpful for users to sometimes do Function Y or Z before X. Therefore, focus on the problem: maximizing the chance that users complete X before attempting to leave the page, not forcing the user to do X before Y and Z. The usual techniques can be used in combination:
If possible, put a workable default in for X, even if it typically needs to be changed most of the time (consider the “New Folder” default and “Old Filename - Copy” used by Windows).
Clearly mark Function X controls as “* Required”.
Consider placing focus on the main control for Function X when the page opens.
Clearly show when Function X is completed (e.g., a filled field is evident)
Disable the Save or Submit or whatever controls moving forward until the user completes Function X.
Consider in-line documentation beside the leave-the-page controls reminding the user that Function X is required. This is necessary if it’s isn’t obvious to the user (and if it varies with the context, I bet it isn’t).
If the above proves inadequate in usability testing, or if you can’t disable the leave-the-page controls (e.g., it could be the Back button) then force the user to complete Function X when leaving the page, not before doing Y or Z. For example, when the user attempts to navigate:
Open a modal dialog box or equivalent to take the input to complete Function X.
Redirect the user to a page that takes the input to do Function X.
Jump to and highlight the portion of the current page dedicated for doing Function X.
In any case, the user should have the ability to:
Complete Function X.
Go back and modify Function Y and Z input.
Cancel work on the page altogether.
If possible, save the work so far and return later (after they figured out what they want or need for Function X).
If all else fails, then use an error message, but you’re correct that that is the technique of last resort.