So this question:
posits what I consider to be an interesting situation. Rochester, NY (USA) is within driving distance of Toronto (Canada), and as Toronto is the much larger city, I would suspect there are many destinations that would make it worth someone’s while to use it as a departure point for an international flight.
A transit visa (assuming you needed one) would suffice if you flew from
YVR, and thence onwards – but what if you drove there? Because you didn’t stay in the sanitized area, I doubt you would qualify.
Now, in that particular situation (the US & Canada are effectively borderless for their citizens) and others like it (Schengen area, other US-Canada), there is very little cost beyond the gas. But, how does this affect the visa you need at your destination? In other words, what considerations about visas do you need if your flight originates from a country other than the one in which you are a citizen?
You’re conflating two entirely different issues here: the visa you need for the destination country (in this case Japan), and the visa(s) you need for any countries along the way (in this case Canada).
Japanese visas are granted based on what you’re going to do in Japan, not based on how you got there — be it a direct flight from Canada, a flight with a stopover in South Korea, a drive to the US followed by a flight, or paddling across the Pacific in a canoe (well, the last of these will probably need some extra paperwork). In your specific case, as (I presume) a US citizen, you’ll get an automatic entry permit on arrival at Narita or Haneda airport.
As far as I’m aware, this is the same for more or less every country in the world, with a couple of edge cases like Thailand that give shorter visas if you cross by land (cheap backpacker scum!) than fly in (rich tourist!) — but it’s still the same visa, only the validity differs.
As for transiting through another country, you usually need, surprise surprise, a transit visa, although the details vary widely. In Canada’s case, in addition to a whole slew of countries that don’t need visas at all (including US citizens), they allow visa-free transit by air for a number of countries’ citizens if they’re going to/from the US. The rest have to apply for a transit visa, but these are only valid for transiting by air and for stays of under 48 hours; if you need a visa for Canada and you’re planning to drive up, you will need a regular “Temporary Resident Visa”, which most other countries would call a tourist visa.