Test questions
can be written to assess true mastery, although it's not so easy as you're trying to make it sound... especially if you want the test to take a sane amount of time, be consistently gradable by different graders, and have any kind of reasonable signal to noise ratio. But sure, you can get there, or at least go a long way toward it.
If you try to actually create tests that way, you will discover that the institutions and political atmosphere around you will punish you harshly. It's "unfair" to give a test that you can't pass by memorizing things, you see. And the people who will ultimately make the decisions about what you're allowed to do with your test are rarely going to care much about actual mastery, and often wouldn't be able to recognize mastery if they did care.
In practice, standardized tests are always going to be easily gamed, so if you make people's and institutions' rewards dependent on them, you will end up diverting more time, energy, and other resources away from actually teaching mastery and into meaningless gaming.