Depends on what you're looking at.
A scripting language is a scripting language, so the instruction sets are not in Japanese. There will be Japanese comments in the code, but they're working with the same statements (if, else, print, etc.) as everyone else.
Now for whether the original in-game text is Japanese first and then translated, the answer is still that it depends, but for a lot of games likely yes, and some other games definitely not.
Older games would be written for Japanese consumers first, then later translated to be sold internationally. This is felt keenly in a lot of older titles where you can see that there were character limits in place that didn't account for longer English words. I'm admittedly not too familiar with Japanese, but I know it uses a syllabary (kana) with Chinese characters (kanji). A loanword like "チャレンジ" is only 5 characters, while the corresponding English word "Challenge" is 9. And a native term using kanji would take up even less space, because those often consist of multiple syllables. So you end up with games getting creative to fit English words into smaller spaces, having to rename certain characters, etc. Pokemon Red/Blue had to use a special little single-character "PKMN" glyph in battles because there was no way to spell out "Pokemon" in that tiny menu.
Newer games usually opt for a global launch and will likely do the writing in multiple languages concurrently. So they are developed from the ground up with the idea that they will have multi-language support and therefore character limits aren't as much of a thing these days.
If the lead writer of a game is credited to a Japanese person, then the primary draft was probably written in Japanese, but they would have been working on the localization before putting much of the script into the game. Some studios will get non-JP writers to do the script, or maybe even have a blend of both (e.g. Elden Ring). And in some cases, maybe there was a Japanese script first, but the character performances prioritize the English cast, who will record their lines before the Japanese cast (e.g. newer Resident Evil games, newer Final Fantasy games, etc.). So it's never cut and dry.
Things that players aren't meant to see, but developers are, will likely not be localized. So if someone ends up triggering debug text, it'll probably be in Japanese (e.g. Ocarina of Time's debug menu seen when doing an arbitrary code execution glitch).
The differences in nuance that occur between translations of a game are down to the discretion of the localizers. It's usually bad form to do direct translations of source material because nuances will not be conveyed 1:1, so they will edit the source material somewhat to try to be more faithful to the intent of the script. If a Pokemon's name was written as a pun in Japanese, then they may try to come up with a corresponding English pun. If a character has some sort of Japanese regional dialect, they'll pick a different English regional dialect to color their dialog (yeehaw). But it's an art, not a science, so some localizations are better than others, and people will have opinions on ones that go too far or not enough (e.g. whether you prefer the original localization of Final Fantasy Tactics or the later one with flowery archaic dialog.)
For Nintendo, I would say it's rare for their Japanese studios to prioritize an English script first. I struggle to think of an example otherwise. But Retro and Next Level Games are western studios that Nintendo owns, so they likely develop in English first with the JP translation being secondary, unless the primary writer is Japanese and comes from Nintendo themselves. Metroid Prime 4 had its English and Japanese script written concurrently. Older Rareware games (Donkey Kong, Star Fox Adventures) were also developed in the UK and written in English first, and same with the original Star Fox for SNES (developed by Argonaut).
Here's another blog I've read before that has some valuable perspective on localizations:
https://legendsoflocalization.com/
They have a really interesting breakdown of Final Fantasy 4 from years ago that is a good read.
Edit: And if you ask why Satoshi was renamed Ash in English, that was a localization decision to give him an English name that bears some similarity to his original Japanese name. Same with Gary, who is originally Shigeru. But in the games, they were always レッド and グリーン, Red and Green (changed to Blue in English).
As for why they felt English names were needed in the first place, I'm guessing they thought the original Japanese names would not be as iconic or recognizable, or that kids would struggle with them.
Similar happened for the cast of Digimon Adventure. Tai/Taichi, Matt/Yamato, TK/Takeru, Kari/Hikari, Izzy/Izumi.