Why? It's the norm in pretty much every country when it comes to making decisions at the national level. If secret voting is not ensured and there's a standard way to verify anybody's vote with 100% certainty, there will be employers firing people for voting for a particular candidate, there will be discounts/freebies for people who voted for a particular candidate, there will be violence and ostracism, celebrities and company executives will be harassed to justify their voting decisions, and all of this WILL pressure everyone's voting decisions (or the decision to not vote, to try to avoid being politicized), so it's not just a problem for the tax institution or police, it becomes a problem of elections fundamentally no longer being free or fair. For this reason we have the secret ballot, and documented election processes to ensure they can overall be trusted despite individual votes being kept secret.
"they can write any confirmation code they want on a ballot and take a photo proof"
Apart from the fact some jurisdictions (such as UK) will discard your vote for writing codes on the ballot, there are a million ways to photoshop or fake a ballot selfie some other way, there's no standard way to be 100% certain how anybody voted.